namespace InABox.Core
{
    [UserTracking(typeof(User))]
    public class SecurityGroup : Entity, IRemotable, IPersistent, ILicense<CoreLicense>
    {
        [EditorSequence(1)]
        [UniqueCodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
        public string Code { get; set; }

        [EditorSequence(2)]
        [TextBoxEditor]
        public string Description { get; set; }

        [EditorSequence(3)]
        public ImageDocumentLink Image { get; set; }

        //[CheckListEditor(typeof(TokenLookups))]
        //public PackableBooleanDictionary Tokens { get; set; }

        //private class TokenLookups : LookupGenerator
        //{
        //    public TokenLookups() : base()
        //    {               
        //        foreach (var token in SecurityFactory.Descriptors)
        //            this[String.Format("{0}: {1}", token.Section, token.Code)] = token.Description;
        //    }
        //}

        protected override void Init()
        {
            base.Init();
            Image = new ImageDocumentLink();
            //Tokens = new PackableBooleanDictionary();
            //foreach (var token in SecurityFactory.Descriptors)
            //    Tokens[String.Format("{0}: {1}",token.Section,token.Code)] = true;
        }

        public override string ToString()
        {
            return string.Format("{0}: {1}", Code, Description);
        }
    }
}