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

namespace adas_core.Domain.Models.DTO;

/// <summary>
/// Represents a data transfer object that combines a master list with pagination options and a collection of unit information items.
/// </summary>
/// <remarks>
/// This DTO packages a <see cref="MasterList"/> together with the configured <c>pageSize</c> and a list of <see cref="UnitInfoDto"/> entries for transport across application boundaries.
/// </remarks>
public class MasterListWithPaginatedOptionsDto(MasterList masterList, int pageSize, List<UnitInfoDto> units)
{
    public ObjectId Id { get; set; } = masterList.Id;
    public string Name { get; set; } = masterList.Name;
    public string Description { get; set; } = masterList.Description;

    public MasterListType ListType { get; set; } = masterList.ListType;
    public bool CanAddElement { get; set; } = masterList.CanAddElement;
    public OptionListDetails? OptionListDetails { get; set; } = masterList.OptionListDetails;

    public int TotalOptionsCount { get; set; } = masterList.Options.Count();
    public List<OptionList> Options { get; set; } = masterList.Options.Take(pageSize).ToList();
    public List<UnitInfoDto> Units { get; set; } = units;
    public LocaleEnum? DefaultLocale { get; set; } = masterList.DefaultLocale;
}