using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Sched.CustomClasses
{
    class Curriculum : INotifyPropertyChanged
    {
        private int _id = 0;
        private string _abbreviation = string.Empty;
        private string _name = string.Empty;
        private string _faculty = string.Empty;
        private int _length = 3;
        private DateTime _accreditStartDT;
        private DateTime _accreditEndDT;
        //private string _accreditStart;  //ISO8061
        //private string _accreditEnd;  //ISO8061
 
        public int Id
        {
            get { return _id; }
            set { _id = value; OnPropertyChanged("Id"); }
        }
        public string Abbreviation
        {
            get { return _abbreviation; }
            set { _abbreviation = value; OnPropertyChanged("Abbreviation"); }
        }
        public string Name
        {
            get { return _name; }
            set { _name = value; OnPropertyChanged("Name"); }
        }
        public string Faculty
        {
            get { return _faculty; }
            set{ _faculty = value; OnPropertyChanged("Faculty"); }
        }
        public int Length
        {
            get { return _length; }
            set { _length = value; OnPropertyChanged("Length"); }
        }
        public DateTime AccreditStartDT
        {
            get { return _accreditStartDT; }
            set
            {
                _accreditStartDT = value;
                //_accreditStart = value.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
                OnPropertyChanged("AccreditStartDT");
            }
        }
        public DateTime AccreditEndDT
        {
            get { return _accreditEndDT; }
            set
            {
                _accreditEndDT = value;
                //_accreditEnd = value.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
                OnPropertyChanged("AccreditEndDT");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string info)
        {
            var handler = PropertyChanged;
            handler?.Invoke(this, new PropertyChangedEventArgs(info));
        }

        public Curriculum()
        {
            this.AccreditStartDT = DateTime.Now;
            this.AccreditEndDT = DateTime.Now;
        }
        public Curriculum(int Id, string Name,string Faculty, int Length, DateTime accreditStartDT, DateTime accreditEndDT)
        {
            this.Id = Id;
            this.Name = Name;
            this.Faculty = Faculty;
            this.Length = Length;
            this.AccreditStartDT = AccreditStartDT;
            this.AccreditEndDT = AccreditEndDT;
        }

        public override string ToString()
        {
            return $"{_abbreviation} - {_name} ({_id})";
        }
    }

    class CurriculumCourse : INotifyPropertyChanged
    {
        private int _curriculumId = 0;
        private int _courseId = 0;
        private int _yearOfStudy = 0;
        private int _semesterTypeId = 0;

        public int CurriculumId
        {
            get { return _curriculumId; }
            set { _curriculumId = value; OnPropertyChanged("CurriculumId"); }
        }
        public int CourseId
        {
            get { return _courseId; }
            set { _courseId = value; OnPropertyChanged("CourseId"); }
        }
        public int YearOfStudy
        {
            get { return _yearOfStudy; }
            set { _yearOfStudy = value; OnPropertyChanged("YearOfStudy"); }
        }
        public int SemesterTypeId
        {
            get { return _semesterTypeId; }
            set { _semesterTypeId = value; OnPropertyChanged("SemesterTypeId"); }
        }

        public CurriculumCourse(){

        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string info)
        {
            var handler = PropertyChanged;
            handler?.Invoke(this, new PropertyChangedEventArgs(info));
        }

        public override string ToString()
        {
            return $"Curriculum:{CurriculumId}, Course:{CourseId}";
        }
    }
}
