using System.ComponentModel.DataAnnotations;

namespace ERPCore.Dtos.Config;

/// <summary>
/// Product configuration resource (docs/11-BACKEND-PHASE1.md §2.8). Singleton.
/// <see cref="ItemTypesEnabled"/> is advisory (frontend-honoured) — see the entity docs.
/// </summary>
public sealed record ProductConfigDto(
    bool SubcategoriesEnabled, bool BrandsEnabled, bool ItemTypesEnabled,
    DateTime? UpdatedAt, int? UpdatedBy);

/// <summary>
/// Full replacement of the flags. <c>UpdatedBy</c> is derived from the token, never posted.
/// <para>
/// The flags are <see cref="bool"/>? deliberately: <c>[Required]</c> on a non-nullable bool
/// is a no-op (it always has a value), so a body of <c>{}</c> would bind every flag to
/// <c>false</c> and silently switch all three features off. Nullable makes the requirement
/// actually bind — an omitted flag is a 400, not an accidental disable.
/// </para>
/// </summary>
public sealed class UpdateProductConfigRequest
{
    [Required] public bool? SubcategoriesEnabled { get; set; }
    [Required] public bool? BrandsEnabled { get; set; }
    [Required] public bool? ItemTypesEnabled { get; set; }
}
