using System;
using InABox.Core;

namespace InABox.Reports.Common
{
    [UserTracking(false)]
    public class ReportTemplate : Entity, IPersistent, IRemotable, ILicense<CoreLicense>
    {
        
        [TextBoxEditor]
        [EditorSequence(1)]
        public string Name { get; set; }

        [ComboLookupEditor(typeof(PrinterLookups), Visible = Core.Visible.Hidden, Editable = Editable.Hidden)]
        [EditorSequence(2)]
        public string PrinterName { get; set; }
        
        [NullEditor]
        public string RDL { get; set; }
        
        [CheckBoxEditor]
        [EditorSequence(3)]
        public bool Visible { get; set; }

        [CheckBoxEditor]
        [EditorSequence(4)]
        public bool AllRecords { get; set; }

        [CheckBoxEditor]
        [EditorSequence(5)]
        public bool SelectedRecords { get; set; }

        [NullEditor]
        public string Script { get; set; }
        
        [NullEditor]
        public string DataModel { get; set; }
        
        [NullEditor]
        public string Section { get; set; }
        
        [NullEditor]
        [Obsolete("All Reports are now Fast Reports-based")]
        public bool IsRDL { get; set; }

        
        protected override void Init()
        {
            base.Init();
            IsRDL = false;
            AllRecords = false;
            SelectedRecords = true;
            Visible = true;
        }
        
        private class PrinterLookups : LookupGenerator<object>
        {
            public PrinterLookups(object[] items) : base(items)
            {
                AddValue("", "No Printer Selected");
                foreach (var printer in ReportPrinters.All)
                    AddValue(printer, printer);
            }
        }
    }
}