#if FRAMEWORK20
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace DevComponents.Schedule.Model
{
    /// 
    /// Defines the daily recurrence settings.
    /// 
    public class DailyRecurrenceSettings : INotifyPropertyChanged, INotifySubPropertyChanged
    {
        #region Internal Implementation
        private AppointmentRecurrence _Recurrence = null;
        /// 
        /// Initializes a new instance of the DailyRecurrenceSettings class.
        /// 
        /// 
        public DailyRecurrenceSettings(AppointmentRecurrence recurrence)
        {
            _Recurrence = recurrence;
        }
        private eDailyRecurrenceRepeat _RepeatOnDaysOfWeek = eDailyRecurrenceRepeat.All;
        /// 
        /// Gets or sets the days of week on which appointment is repeated.
        /// 
        [DefaultValue(eDailyRecurrenceRepeat.All)]
        public eDailyRecurrenceRepeat RepeatOnDaysOfWeek
        {
            get { return _RepeatOnDaysOfWeek; }
            set
            {
                if (value != _RepeatOnDaysOfWeek)
                {
                    eDailyRecurrenceRepeat oldValue = _RepeatOnDaysOfWeek;
                    _RepeatOnDaysOfWeek = value;
                    OnRepeatOnDaysOfWeekChanged(oldValue, value);
                }
            }
        }
        private void OnRepeatOnDaysOfWeekChanged(eDailyRecurrenceRepeat oldValue, eDailyRecurrenceRepeat newValue)
        {
            OnPropertyChanged(new PropertyChangedEventArgs("RepeatOnDaysOfWeek"));
        }
        private int _RepeatInterval = 1;
        /// 
        /// Gets or sets the interval between recurring appointments. Default value is 1. Setting this value to for example 3 means that
        /// recurrence is repeated every 3 days.
        /// 
        [DefaultValue(1)]
        public int RepeatInterval
        {
            get { return _RepeatInterval; }
            set
            {
                if (value != _RepeatInterval)
                {
                    int oldValue = _RepeatInterval;
                    _RepeatInterval = value;
                    OnRepeatIntervalChanged(oldValue, value);
                }
            }
        }
        private void OnRepeatIntervalChanged(int oldValue, int newValue)
        {
            OnPropertyChanged(new PropertyChangedEventArgs("RepeatInterval"));
        }
        private bool _ExplicitDailyRecurrence = false;
        /// 
        /// Indicates whether appointment is explicitly repeated every day regardless of its end time. By default end time of appointment + 1 day is considered as next
        /// starting point for appointment. When this property is set to true appointment start time + 1 day is used as next starting point of recurrence.
        /// 
        [DefaultValue(false), Description("Indicates whether appointment is explicitly repeated every day regardless of its end time. By default end time of appointment + 1 day is considered as next starting point for appointment. When this property is set to true appointment start time + 1 day is used as next starting point of recurrence.")]
        public bool ExplicitDailyRecurrence
        {
            get { return _ExplicitDailyRecurrence; }
            set
            {
                if (value != _ExplicitDailyRecurrence)
                {
                    bool oldValue = _ExplicitDailyRecurrence;
                    _ExplicitDailyRecurrence = value;
                    OnExplicitDailyRecurrenceChanged(oldValue, value);
                }
            }
        }
        /// 
        /// Called when ExplicitDailyRecurrence property has changed.
        /// 
        /// Old property value
        /// New property value
        protected virtual void OnExplicitDailyRecurrenceChanged(bool oldValue, bool newValue)
        {
            OnPropertyChanged(new PropertyChangedEventArgs("ExplicitDailyRecurrence"));
            
        }
        #endregion
        #region INotifyPropertyChanged Members
        /// 
        /// Occurs when property value has changed.
        /// 
        public event PropertyChangedEventHandler PropertyChanged;
        /// 
        /// Raises the PropertyChanged event.
        /// 
        /// Event arguments
        protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            PropertyChangedEventHandler eh = PropertyChanged;
            if (eh != null) eh(this, e);
            OnSubPropertyChanged(new SubPropertyChangedEventArgs(this, e));
        }
        #endregion
        #region INotifySubPropertyChanged Members
        /// 
        /// Occurs when property or property of child objects has changed. This event is similar to PropertyChanged event with key
        /// difference that it occurs for the property changed of child objects as well.
        /// 
        public event SubPropertyChangedEventHandler SubPropertyChanged;
        /// 
        /// Raises the SubPropertyChanged event.
        /// 
        /// Event arguments
        protected virtual void OnSubPropertyChanged(SubPropertyChangedEventArgs e)
        {
            SubPropertyChangedEventHandler eh = SubPropertyChanged;
            if (eh != null) eh(this, e);
        }
        #endregion
    }
}
#endif