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;

        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 Title(int id, string shortName, string adPrefix, double maxDiscount)
        {
            _id = id;
            _shortName = shortName;
            _adPrefix = adPrefix;
            _maxDiscount = maxDiscount;
        }

        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;
        }
    }
}