using System.Diagnostics.CodeAnalysis;

namespace AyCode.Core.Extensions
{
    public static class GuidExtensions
    {
        //[ContractAnnotation("=> true, result: notnull; => false, result: null")]
        //[ContractAnnotation("true => null; false => notnull")]
        public static bool IsNullOrEmpty([NotNullWhen(false)] this Guid guid) => guid == Guid.Empty;
        
        //[ContractAnnotation("=> true, result: notnull; => false, result: null")]
        //[ContractAnnotation("guid:null => true; guid:notnull <= false")]
        public static bool IsNullOrEmpty([NotNullWhen(false)] this Guid? guid) => guid == null || guid == Guid.Empty;
    }
}
