using System.ComponentModel.DataAnnotations;
namespace ROLAC.API.DTOs.Expense;

public class ExpenseSnapshotLineDto
{
    public int      CategoryGroupId   { get; set; }
    public string   CategoryGroupName { get; set; } = "";
    public int      SubCategoryId     { get; set; }
    public string   SubCategoryName   { get; set; } = "";
    public string?  FunctionalClass   { get; set; }
    public decimal  Amount            { get; set; }
    public string?  Description       { get; set; }
}

public class ExpenseSnapshotDto
{
    public int      Id           { get; set; }
    public string   Name         { get; set; } = "";
    public int      MinistryId   { get; set; }
    public string   MinistryName { get; set; } = "";
    public string   Description  { get; set; } = "";
    public string?  VendorName   { get; set; }
    public string?  CheckNumber  { get; set; }
    public string?  Notes        { get; set; }
    public decimal  TotalAmount  { get; set; }   // sum of line amounts (list hint)
    public int      LineCount    { get; set; }
    public string?  CreatedByName { get; set; }  // resolved Member full name, email fallback
    public DateTimeOffset CreatedAt { get; set; }
    public List<ExpenseSnapshotLineDto> Lines { get; set; } = new();
}

public class CreateExpenseSnapshotRequest
{
    [Required, MaxLength(150)] public string Name { get; set; } = "";
    [Required] public int MinistryId { get; set; }
    [Required, MinLength(1)] public List<ExpenseLineInput> Lines { get; set; } = new();
    [Required, MaxLength(500)] public string Description { get; set; } = "";
    [MaxLength(200)] public string? VendorName  { get; set; }
    [MaxLength(50)]  public string? CheckNumber { get; set; }
    public string? Notes { get; set; }
}
public class UpdateExpenseSnapshotRequest : CreateExpenseSnapshotRequest { }
