using Quadarax.Foundation.Core.QConsole.Argument;

namespace Quadarax.Foundation.Core.QConsole.Extensions
{
    internal static class AbstractArgumentExt
    {
        internal static bool IsPositional(this AbstractArgument owner)
        {
            return owner.GetType().Name == nameof(OrdinalArgument);
        }
        internal static bool IsFlag(this AbstractArgument owner)
        {
            return owner.GetType().Name == nameof(FlagArgument);
        }

        internal static bool IsCodeAccessAllowed(this AbstractArgument owner)
        {
            return !IsPositional(owner) || ((OrdinalArgument) owner).IsCodeAllowed;
        }
    }
}
