using System;

using BS.Shared;
using BS.Shared.Core;

namespace BeWo.Data.Entities
{
    public class AppointmentAbsenceTime : BeWoEntityBase
    {
        public static string PropertyName_AbsenceReason = "AbsenceReason";

        public static string PropertyName_End = "End";

        public static string PropertyName_Start = "Start";

        public static string PropertyName_CustomerOid = "CustomerOid";

        public static string PropertyName_EmployeeOid = "EmployeeOid";

        private AbsenceReason _AbsenceReason;

        private DateTime? _End;

        private DateTime? _Start;

        private long? _CustomerOid;

        private long? _EmployeeOid;

        public AppointmentAbsenceTime()
        {
            this._Tid = TableID.AbsenceTime;
        }

        public virtual AbsenceReason AbsenceReason
        {
            get
            {
                return this._AbsenceReason;
            }

            set
            {
                if (this.AreDifferent(this._AbsenceReason, value))
                {
                    this._AbsenceReason = value;
                }
            }
        }

        public virtual DateTimeSpan AbsenceSpan
        {
            get
            {
                if (this.Start.HasValue)
                {
                    return new DateTimeSpan { StartDateTime = this.Start.Value, EndDateTime = this.End ?? DateTime.MaxValue };
                }

                return null;
            }
        }

        public virtual DateTime? End
        {
            get
            {
                return this._End;
            }

            set
            {
                if (this.AreDifferent(this._End, value))
                {
                    this._End = value;
                }
            }
        }

        public virtual DateTime? Start
        {
            get
            {
                return this._Start;
            }

            set
            {
                if (this.AreDifferent(this._Start, value))
                {
                    this._Start = value;
                }
            }
        }

        public virtual long? CustomerOid
        {
            get
            {
                return this._CustomerOid;
            }

            set
            {
                if (this.AreDifferent(this._CustomerOid, value))
                {
                    this._CustomerOid = value;
                }
            }
        }

        public virtual long? EmployeeOid
        {
            get
            {
                return this._EmployeeOid;
            }

            set
            {
                if (this.AreDifferent(this._EmployeeOid, value))
                {
                    this._EmployeeOid = value;
                }
            }
        }
    }
}