// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Esiur.Data
{
    /// 
    /// A class that represents nullability info
    /// 
    public sealed class NullabilityInfo
    {
        internal NullabilityInfo(Type type, NullabilityState readState, NullabilityState writeState,
            NullabilityInfo? elementType, NullabilityInfo[] typeArguments)
        {
            Type = type;
            ReadState = readState;
            WriteState = writeState;
            ElementType = elementType;
            GenericTypeArguments = typeArguments;
        }
        /// 
        /// The  of the member or generic parameter
        /// to which this NullabilityInfo belongs
        /// 
        public Type Type { get; }
        /// 
        /// The nullability read state of the member
        /// 
        public NullabilityState ReadState { get; internal set; }
        /// 
        /// The nullability write state of the member
        /// 
        public NullabilityState WriteState { get; internal set; }
        /// 
        /// If the member type is an array, gives the  of the elements of the array, null otherwise
        /// 
        public NullabilityInfo? ElementType { get; }
        /// 
        /// If the member type is a generic type, gives the array of  for each type parameter
        /// 
        public NullabilityInfo[] GenericTypeArguments { get; }
    }
    /// 
    /// An enum that represents nullability state
    /// 
    public enum NullabilityState
    {
        /// 
        /// Nullability context not enabled (oblivious)
        /// 
        Unknown,
        /// 
        /// Non nullable value or reference type
        /// 
        NotNull,
        /// 
        /// Nullable value or reference type
        /// 
        Nullable
    }
}