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

namespace ERPCore.Dtos.Vendors;

/// <summary>Vendor resource (docs/11-BACKEND-PHASE1.md §2.4).</summary>
public sealed record VendorDto(
    int VendorId, string Code, string Name, string? Terms, string? TaxReg,
    string Currency, EntityStatus Status, DateTime CreatedAt, DateTime? UpdatedAt);

public sealed class CreateVendorRequest
{
    [Required, StringLength(50)] public string Code { get; set; } = string.Empty;
    [Required, StringLength(200)] public string Name { get; set; } = string.Empty;
    [StringLength(50)] public string? Terms { get; set; }
    [StringLength(50)] public string? TaxReg { get; set; }
    [Required, StringLength(3, MinimumLength = 3)] public string Currency { get; set; } = "LKR";
}

public sealed class UpdateVendorRequest
{
    [Required, StringLength(50)] public string Code { get; set; } = string.Empty;
    [Required, StringLength(200)] public string Name { get; set; } = string.Empty;
    [StringLength(50)] public string? Terms { get; set; }
    [StringLength(50)] public string? TaxReg { get; set; }
    [Required, StringLength(3, MinimumLength = 3)] public string Currency { get; set; } = "LKR";
}

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