using System.Collections.Generic;
using Baza_Reklam.Classes.Repositories;

namespace Baza_Reklam.Classes.Model
{
    public class Title
    {
        private int _id;
        private string _shortName;
        private string _fullName;
        private string _adPrefix;
        private double _maxDiscount;
        private bool _isActive;
        private int _invoiceProvider;

        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }

        public string ShortName
        {
            get { return _shortName; }
            set { _shortName = value; }
        }

        public string FullName
        {
            get { return _fullName; }
            set { _fullName = value; }
        }

        public bool IsActive
        {
            get { return _isActive; }
            set { _isActive = value; }
        }

        public List<Section> Sections
        {
            get 
            { 
                SectionRepository sectionRepository = new SectionRepository();
                return sectionRepository.FindAllActiveByTitle(this); 
            }
        }

        public string AdPrefix
        {
            get { return _adPrefix; }
            set { _adPrefix = value; }
        }

        public double MaxDiscount
        {
            get { return _maxDiscount; }
            set { _maxDiscount = value; }
        }

        public int InvoiceProvider
        {
            get { return _invoiceProvider; }
            set { _invoiceProvider = value; }
        }

        public Title(int id, string shortName, string adPrefix, double maxDiscount, int invoiceProvider)
        {
            _id = id;
            _shortName = shortName;
            _adPrefix = adPrefix;
            _maxDiscount = maxDiscount;
            _invoiceProvider = invoiceProvider;
        }

        public Title(int id, string shortName, string adPrefix, double maxDiscount, string fullName, bool isActive)
        {
            _id = id;
            _shortName = shortName;
            _adPrefix = adPrefix;
            _maxDiscount = maxDiscount;
            _fullName = fullName;
            _isActive = isActive;
        }
    }
}