using Lada.Framework.Data.Enums;
using Lada.Framework.DTO;

namespace Ladaer.BackEnd.Infrastructures.DTO.Results.Premises
{
    /// <summary>
    /// Kết quả chi tiết mặt bằng
    /// </summary>
    public class PremiseResult : BaseResult
    {
        public int Id { get; set; }
        public string Code { get; set; } = string.Empty;
        public PremiseStatus Status { get; set; }
        public int AgencyId { get; set; }
        public string AgencyName { get; set; } = string.Empty;
        public int CityId { get; set; }
        public string CityName { get; set; } = string.Empty;
        public int DistrictId { get; set; }
        public string DistrictName { get; set; } = string.Empty;
        public int WardId { get; set; }
        public string WardName { get; set; } = string.Empty;
        public string AddressDetail { get; set; } = string.Empty;
        public double? Latitude { get; set; }
        public double? Longitude { get; set; }
        public string? GoogleMapUrl { get; set; }
        public int TotalScore { get; set; }
        public string? Description { get; set; }

        public string CreatedByUserName { get; set; } = string.Empty;
        public DateTimeOffset? CreatedTime { get; set; }

        /// <summary>
        /// Thông tin tài chính
        /// </summary>
        public PremiseFinancialDetail? Financial { get; set; }

        /// <summary>
        /// Danh sách liên hệ
        /// </summary>
        public List<PremiseContactDetail> Contacts { get; set; } = new();

        /// <summary>
        /// Danh sách điểm chấm
        /// </summary>
        public List<PremiseScoreDetail> Scores { get; set; } = new();

        /// <summary>
        /// Danh sách ảnh/media
        /// </summary>
        public List<PremiseMediaDetail> Medias { get; set; } = new();
    }

    public class PremiseFinancialDetail
    {
        public int Id { get; set; }
        public decimal? AskingRent { get; set; }
        public decimal? NegotiatedRent { get; set; }
        public int? DepositMonths { get; set; }
        public int? PaymentPeriodMonths { get; set; }
        public int? FreeFitOutDays { get; set; }
        public DateTime? AvailableFromDate { get; set; }
        public bool CanProvideVatInvoice { get; set; }
        public string? LegalNote { get; set; }
    }

    public class PremiseContactDetail
    {
        public int Id { get; set; }
        public string FullName { get; set; } = string.Empty;
        public string PhoneNumber { get; set; } = string.Empty;
        public PremiseContactRole Role { get; set; }
        public string? Note { get; set; }
    }

    public class PremiseScoreDetail
    {
        public int Id { get; set; }
        public int CriteriaId { get; set; }
        public string CriteriaName { get; set; } = string.Empty;
        public ScoringCriteriaType CriteriaType { get; set; }
        public int? SelectedOptionId { get; set; }
        public string? SelectedOptionLabel { get; set; }
        public string? TextValue { get; set; }
        public decimal? NumericValue { get; set; }
        public int Score { get; set; }
        public string? Note { get; set; }
    }

    public class PremiseMediaDetail
    {
        public int Id { get; set; }
        public Guid MediaId { get; set; }
        public PremiseMediaType MediaType { get; set; }
        public string Url { get; set; } = string.Empty;
        public int DisplayOrder { get; set; }
    }
}
