using System.ComponentModel.DataAnnotations;
using ERPCore.Domain.Enums;

namespace ERPCore.Dtos.ItemTypes;

/// <summary>
/// Item type resource (docs/11-BACKEND-PHASE1.md §2.7) — a dimension name such as Color
/// or Size. Carries no values and no item linkage: <c>GET /item-types</c> exists to
/// populate the frontend builder's dropdown, and the chosen values are encoded into the
/// client-generated SKU rather than stored (docs/10 Part C.9).
/// </summary>
public sealed record ItemTypeDto(
    int ItemTypeId, string Name, EntityStatus Status, DateTime CreatedAt, DateTime? UpdatedAt);

// Request DTOs — narrow: server-controlled fields (status, ids, timestamps)
// are intentionally excluded to prevent over-posting (02-SECURITY B.6 / C.1). ----

public sealed class CreateItemTypeRequest
{
    [Required, StringLength(200)] public string Name { get; set; } = string.Empty;
}

public sealed class UpdateItemTypeRequest
{
    [Required, StringLength(200)] public string Name { get; set; } = string.Empty;
}

public sealed class UpdateItemTypeStatusRequest
{
    [Required, EnumDataType(typeof(EntityStatus))] public EntityStatus Status { get; set; }
}
