using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace DevComponents.Schedule.Model
{
    /// 
    /// Represents specific date based work day.
    /// 
    public class CalendarWorkDay : BaseWorkDay
    {
        #region Internal Implementation
        /// 
        /// Initializes a new instance of the WorkDay class.
        /// 
        public CalendarWorkDay()
        {
        }
        /// 
        /// Initializes a new instance of the WorkDay class.
        /// 
        /// Date this work-day represents
        public CalendarWorkDay(DateTime date)
        {
            _Date = date;
        }
        private DateTime _Date = DateTime.MinValue;
        /// 
        /// Gets or sets the date this day represents.
        /// 
        public DateTime Date
        {
            get { return _Date; }
            set
            {
                value = value.Date;
                if (value != _Date)
                {
                    DateTime oldValue = _Date;
                    _Date = value;
                    OnDateChanged(oldValue, value);
                }
            }
        }
        /// 
        /// Called when Date property has changed.
        /// 
        /// Old property value.
        /// New property value.
        protected virtual void OnDateChanged(DateTime oldValue, DateTime newValue)
        {
            OnPropertyChanged(new PropertyChangedEventArgs("Date"));
        }
        #endregion
    }
}