using System;
using System.Collections.Generic;

namespace AyaNovaQBI
{
    internal class WorkOrder
    {
        public long Id { get; set; }
        public uint Concurrency { get; set; }


        public long Serial { get; set; }

        public string Notes { get; set; }//WAS "SUMMARY"
        public string Wiki { get; set; }
        public string CustomFields { get; set; }
        public List<string> Tags { get; set; } = new List<string>();


        public long CustomerId { get; set; }

        public string CustomerViz { get; set; }


        public string CustomerTechNotesViz { get; set; }

        public string CustomerPhone1Viz { get; set; }

        public string CustomerPhone2Viz { get; set; }

        public string CustomerPhone3Viz { get; set; }

        public string CustomerPhone4Viz { get; set; }

        public string CustomerPhone5Viz { get; set; }

        public string CustomerEmailAddressViz { get; set; }

        public long? ProjectId { get; set; }

        public string ProjectViz { get; set; }
        public string InternalReferenceNumber { get; set; }
        public string CustomerReferenceNumber { get; set; }
        public string CustomerContactName { get; set; }
        public long? FromQuoteId { get; set; }
        public long? FromPMId { get; set; }

        public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
        public DateTime? ServiceDate { get; set; }
        public DateTime? CompleteByDate { get; set; }
        public TimeSpan DurationToCompleted { get; set; } = TimeSpan.Zero;
        public string InvoiceNumber { get; set; }
        public string CustomerSignature { get; set; }
        public string CustomerSignatureName { get; set; }
        public DateTime? CustomerSignatureCaptured { get; set; }
        public string TechSignature { get; set; }
        public string TechSignatureName { get; set; }
        public DateTime? TechSignatureCaptured { get; set; }
        public bool Onsite { get; set; }
        public long? ContractId { get; set; }

        public string ContractViz { get; set; }

        //redundant field to speed up list queries
        //(added after status system already coded)
        public long? LastStatusId { get; set; }


        //POSTAL ADDRESS / "BILLING ADDRESS"
        public string PostAddress { get; set; }
        public string PostCity { get; set; }
        public string PostRegion { get; set; }
        public string PostCountry { get; set; }
        public string PostCode { get; set; }

        //PHYSICAL ADDRESS / "SERVICE ADDRESS"
        public string Address { get; set; }
        public string City { get; set; }
        public string Region { get; set; }
        public string Country { get; set; }
        public decimal? Latitude { get; set; }
        public decimal? Longitude { get; set; }

        public List<WorkOrderItem> Items { get; set; } = new List<WorkOrderItem>();
        //  public List<WorkOrderState> States { get; set; } = new List<WorkOrderState>();


        //UTILITY FIELDS    

        public bool IsLockedAtServer { get; set; } = false;//signal to client that it came from the server in a locked state

        public string AlertViz { get; set; } = null;

        public string FromQuoteViz { get; set; }

        public string FromPMViz { get; set; }


        public string LastStateUserViz { get; set; }

        public string LastStateNameViz { get; set; }

        public string LastStateColorViz { get; set; }

        public bool LastStateCompletedViz { get; set; }

        public bool LastStateLockedViz { get; set; }



        public bool IsCompleteRecord { get; set; } = true;//indicates if some items were removed due to user role / type restrictions (i.e. woitems they are not scheduled on)


        public bool UserIsRestrictedType { get; set; }

        public bool UserIsTechRestricted { get; set; }

        public bool UserIsSubContractorFull { get; set; }

        public bool UserIsSubContractorRestricted { get; set; }

        public bool UserCanViewPartCosts { get; set; }

        public bool UserCanViewLaborOrTravelRateCosts { get; set; }

        public bool UserCanViewLoanerCosts { get; set; }
    }
}
