using adas_core.Domain.Enums;
using adas_core.Domain.Models.Masters;
using MongoDB.Bson;

namespace adas_core.Domain.Models.MongoModels;

/// <summary>
/// Represents a unit, typically used as a return type for operations that have no meaningful result value.
/// </summary>
public class Unit
{
    public ObjectId Id { get; set; }
    public string? Title { get; set; }

    public string? Name { get; set; }

    // Ya que la configuración de la unidad (anterior section) se va a poder actualizar
    // tiene sentido mantener esta propiedad aunque no se está usando en el modelo anterior
    public DateTime? LastUpdate { get; set; }

    // Anteriormente SectionItem
    public List<ObjectId>? PointOfCareIds { get; set; }
    public int PocCount => PointOfCares?.Count ?? 0;

    public StatusEnum.Type? Status { get; set; }
    public UnitConfiguration Configuration { get; set; } = new();

    public ObjectId? AltableOptionListId { get; set; }
    public ObjectId? AllergyListId { get; set; }
    public ObjectId? DestinationListId { get; set; }
    public ObjectId? InternalDestinationListId { get; set; }
    public ObjectId? DiagnosisListId { get; set; }
    public ObjectId? DoctorListId { get; set; }
    public ObjectId? DoctorTypeListId { get; set; }
    public ObjectId? InsulationListId { get; set; }
    public ObjectId? MobilityOptionListId { get; set; }
    public ObjectId? OriginListId { get; set; }
    public ObjectId? PatientStatusListId { get; set; }
    public ObjectId? ProcedureListId { get; set; }
    public ObjectId? TestListId { get; set; }
    public ObjectId? ServiceListId { get; set; }
    public ObjectId? TherapeuticCeilingListId { get; set; }
    public ObjectId? TreatmentListId { get; set; }
    public ObjectId? VisitOptionListId { get; set; }
    public ObjectId? AccessControlListId { get; set; }
    public ObjectId? LanguageBarrierListId { get; set; }
    public ObjectId? DischargeStatusListId { get; set; }
    public ObjectId? PassiveSittingListId { get; set; }
    public ObjectId? GenericListId { get; set; }

    #region Unmap

    public List<PointOfCare>? PointOfCares { get; set; }
    public AltableOptionList? AltableOptionList { get; set; }
    public AllergyList? AllergyList { get; set; }
    public DestinationList? DestinationList { get; set; }
    public InternalDestinationList? InternalDestinationList { get; set; }
    public DiagnosisList? DiagnosisList { get; set; }
    public DoctorList? DoctorList { get; set; }
    public DoctorTypeList? DoctorTypeList { get; set; }
    public InsulationList? InsulationList { get; set; }
    public MobilityOptionList? MobilityOptionList { get; set; }
    public OriginList? OriginList { get; set; }
    public PatientStatusList? PatientStatusList { get; set; }
    public ProcedureList? ProcedureList { get; set; }
    public TestList? TestList { get; set; }
    public ServiceList? ServiceList { get; set; }
    public TherapeuticCeilingList? TherapeuticCeilingList { get; set; }
    public TreatmentList? TreatmentList { get; set; }
    public VisitOptionList? VisitOptionList { get; set; }
    public AccessControlList? AccessControlList { get; set; }

    public DischargeStatusList? DischargeStatusList { get; set; }
    public LanguageBarrierList? LanguageBarrierList { get; set; }
    public PassiveSittingList? PassiveSittingList { get; set; }
    public GenericList? GenericList { get; set; }

    #endregion
}

/// <summary>
/// Represents the configuration settings for a unit.
/// </summary>
public class UnitConfiguration
{
    public bool AutoAdt { get; set; }
    public bool ManualDischarge { get; set; } = true;
    public bool ManualAdmit { get; set; } = true;
    public bool ManualMove { get; set; } = true;
    public bool ManualEdit { get; set; } = true;
    public ObjectId? PlanDisplayConfiguration { get; set; }
    public ObjectId? SmartDisplayConfiguration { get; set; }
    public ObjectId? StandarDisplayConfiguration { get; set; }
}