using MongoDB.Bson;

namespace adas_core.Domain.Models.Masters;

/// <summary>
/// Represents a list that contains a collection of options.
/// </summary>
public class OptionList
{
    public ObjectId? Id { get; set; }
    public Locale? LocaleItems { get; set; }
    public string? OptionType { get; set; }
    public string Name { get; set; } = string.Empty;
    public string? IconDefault { get; set; }
    public string? IconCategory { get; set; } 
    public string? IconColor { get; set; } 
    public string? Color { get; set; }
    public string? BgColor { get; set; }
    public string? Description { get; set; }
    public DateTime? InitDate { get; set; }
    public DateTime? EndDate { get; set; }
    public bool? IsDefault { get; set; }

    /// <summary>
    /// Compares two <see cref="OptionList"/> instances to determine whether they are equal by checking all of their properties, including type, name, icons, colors, dates, description, and default flag.
    /// </summary>
    /// <param name="a">The first <see cref="OptionList"/> to compare.</param>
    /// <param name="b">The second <see cref="OptionList"/> to compare.</param>
    /// <returns><c>true</c> if all compared properties of both <see cref="OptionList"/> instances are equal; otherwise, <c>false</c>.</returns>
    public bool AreEqual(OptionList a, OptionList b)
        {
            return a.OptionType == b.OptionType &&
                   a.Name == b.Name &&
                   a.IconDefault == b.IconDefault &&
                   a.IconCategory == b.IconCategory && 
                   a.IconColor == b.IconColor && 
                   a.Color == b.Color &&
                   a.BgColor == b.BgColor &&
                   a.IsDefault == b.IsDefault &&
                   a.Description == b.Description &&
                   a.InitDate == b.InitDate &&
                   a.EndDate == b.EndDate;
        }

    /// <summary>
    /// Determines whether two <see cref="OptionList"/> instances are equal based on their core properties, excluding the Description field.
    /// </summary>
    /// <param name="a">The first <see cref="OptionList"/> to compare.</param>
    /// <param name="b">The second <see cref="OptionList"/> to compare.</param>
    /// <returns><c>true</c> if both option lists match across OptionType, Name, IconDefault, IconCategory, IconColor, Color, BgColor, IsDefault, InitDate, and EndDate; otherwise, <c>false</c>.</returns>
    public bool AreEqualExcludeDescription(OptionList a, OptionList b)
        {
            return a.OptionType == b.OptionType &&
                   a.Name == b.Name &&
                   a.IconDefault == b.IconDefault &&
                   a.IconCategory == b.IconCategory &&
                   a.IconColor == b.IconColor &&
                   a.Color == b.Color &&
                   a.BgColor == b.BgColor &&
                   a.IsDefault == b.IsDefault &&
                   a.InitDate == b.InitDate &&
                   a.EndDate == b.EndDate;
        }
}

/// <summary>
/// Represents a locale, providing culture-specific or region-specific information such as language, country, or regional settings.
/// </summary>
public class Locale
{
    public LocaleItem? Es { get; set; }
    public LocaleItem? Pt { get; set; }
    public LocaleItem? Ca { get; set; }
    public LocaleItem? Eng { get; set; }
    public LocaleItem? Zh { get; set; }
}

/// <summary>
/// Represents a single locale item, typically used to encapsulate locale-related data such as language or regional settings.
/// </summary>
public class LocaleItem
{
    public string? Name { get; set; }
}

public enum LocaleEnum
{
    Default,
    Es,
    Pt,
    Ca,
    Eng,
    Zh
}