using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

using BS.Shared.Core;

namespace BS.Shared.DataContracts
{
    [DataContract]
    public class SupportConceptApprovalPeriodDC : IDataContract
    {
        [DataMember]
        public SupportConceptApprovalInterval? ApprovedBEInterval { get; set; }

        [DataMember]
        public decimal? ApprovedBEPerInterval { get; set; }

		[DataMember]
		public SupportConceptApprovalInterval? ContactCountInterval { get; set; }

		[DataMember]
		public decimal? ContactCountPerInterval { get; set; }

		[DataMember]
		public decimal? ApprovedBETotal { get; set; }

        [DataMember]
        public decimal? ApprovedFixedAmount { get; set; }

        [DataMember]
        public SupportConceptApprovalInterval? ApprovedFixedAmountInterval { get; set; }

        [DataMember]
        public DateTime? EndDate { get; set; }

        [DataMember]
        public bool IsApprovedBEShifting { get; set; }

        [DataMember]
        public bool IsApprovedFixedAmountShifting { get; set; }

        [DataMember]
        public decimal? MonthlyPayment { get; set; }

        public DateTimeSpan Span
        {
            get
            {
                var sd = DateTime.MinValue;
                var ed = DateTime.MaxValue;

                if (StartDate.HasValue)
                {
                    sd = StartDate.Value;
                }

                if (EndDate.HasValue)
                {
                    ed = EndDate.Value;
                }
                
                return new DateTimeSpan
                        {
                            StartDateTime = sd,
                            EndDateTime = ed
                        };
            }
        }

        [DataMember]
        public DateTime? StartDate { get; set; }

        [DataMember]
        public decimal? Percentage { get; set; }

        [DataMember]
        public long? SupportConceptApprovalPeriodOid { get; set; }

        [DataMember]
        public long? SupportConceptApprovalPeriodVersion { get; set; }

        [DataMember]
        public ServiceCategoryDC ServiceCategory { get; set; }

        [DataMember]
        public List<SupportConceptApprovalPeriodEmployeeRelDC> SupportConceptApprovalPeriodEmployeeRelations { get; set; }
    }
}