using UnivateProperties_API.Model.Users;

namespace UnivateProperties_API.Containers.Timeshare.Detailed
{
    public class DetailedOwner
    {
        public DetailedOwner()
        {
            BankingDetails = new DetailedBankDetails();
            Address = new DetailedAddress();
        }

        public DetailedOwner(Individual individual)
        {
            Id = individual.Id;
            Name = individual.Name;
            Surname = individual.Surname;
            IdNumber = individual.IdNumber;
            CompanyRegNumber = individual.CompanyRegNumber;
            MaritalStatus = individual.MaritalStatus;
            EmailAddress = individual.Email;
            CellNumber = individual.CellNumber;
            LandlineNumber = individual.Telephone;
            if (individual.Address != null)
            {
                Address = individual.Address != null ? new DetailedAddress(individual.Address) : new DetailedAddress();
            }
            else Address = new DetailedAddress();
            if (BankingDetails != null)
            {
                BankingDetails = individual.BankAccount != null ? new DetailedBankDetails(individual.BankAccount) : new DetailedBankDetails();
            }
            else BankingDetails = new DetailedBankDetails();
        }

        public DetailedOwner(Agent agent)
        {
            Id = agent.Id;
            Name = agent.Name;
            Surname = agent.Surname;
            EmailAddress = agent.Email;
            CellNumber = agent.CellNumber;
            LandlineNumber = agent.Telephone;
            Address = new DetailedAddress();
            BankingDetails = new DetailedBankDetails();
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }
        public string IdNumber { get; set; }
        public string CompanyRegNumber { get; set; }
        public string MaritalStatus { get; set; }
        public string EmailAddress { get; set; }
        public string CellNumber { get; set; }
        public string LandlineNumber { get; set; }
        public DetailedAddress Address { get; set; }
        public DetailedBankDetails BankingDetails { get; set; }
    }
}