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

namespace ERPCore.Dtos.Hrm;

public sealed record HrDocumentTypeDto(
    int HrDocumentTypeId, string Code, string Name, HrDocumentCategory Category,
    bool RequiredAtOnboarding, bool ExpiryTracked, EntityStatus Status,
    DateTime CreatedAt, DateTime? UpdatedAt);

public sealed class CreateHrDocumentTypeRequest
{
    [Required, StringLength(20)] public string Code { get; set; } = string.Empty;
    [Required, StringLength(200)] public string Name { get; set; } = string.Empty;
    [Required, EnumDataType(typeof(HrDocumentCategory))] public HrDocumentCategory Category { get; set; }
    public bool RequiredAtOnboarding { get; set; }
    public bool ExpiryTracked { get; set; }
}

public sealed class UpdateHrDocumentTypeRequest
{
    [Required, StringLength(200)] public string Name { get; set; } = string.Empty;
    [Required, EnumDataType(typeof(HrDocumentCategory))] public HrDocumentCategory Category { get; set; }
    public bool RequiredAtOnboarding { get; set; }
    public bool ExpiryTracked { get; set; }
}

public sealed record EmployeeDocumentDto(
    int EmployeeDocumentId, int EmployeeId, int HrDocumentTypeId, string? HrDocumentTypeName,
    string OriginalFileName, string ContentType, long SizeBytes,
    DateTime? IssueDate, DateTime? ExpiryDate, string? Notes,
    int UploadedBy, DateTime UploadedAt, EmployeeDocumentStatus Status);

/// <summary>Metadata accompanying a multipart file upload (the file itself is bound separately).</summary>
public sealed class UploadEmployeeDocumentRequest
{
    [Required] public int HrDocumentTypeId { get; set; }
    public DateTime? IssueDate { get; set; }
    public DateTime? ExpiryDate { get; set; }
    [StringLength(1000)] public string? Notes { get; set; }
}

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