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

/// <summary>Request body for the expense AI assist endpoint.</summary>
public class ExpenseAiAssistRequest
{
    /// <summary>The user's free-text expense description (typically Chinese).</summary>
    [Required] public string Text { get; set; } = "";
    /// <summary>The expense amount, used as a hint when classifying the category.</summary>
    public decimal Amount { get; set; }
}

/// <summary>
/// AI suggestion for an expense: an English translation of the description plus a proposed
/// major category (大項) and sub-category (系項). Category ids are null when the model could
/// not confidently classify or returned an id outside the live catalog.
/// </summary>
public class ExpenseAiSuggestion
{
    public string? EnglishDescription { get; set; }
    /// <summary>Typo-corrected, refined Traditional Chinese description.</summary>
    public string? ChineseDescription { get; set; }
    public int?    GroupId            { get; set; }
    public int?    SubCategoryId      { get; set; }
    /// <summary>Bilingual label of the suggested group, e.g. "Consumables / 消耗品".</summary>
    public string? GroupLabel         { get; set; }
    /// <summary>Bilingual label of the suggested sub-category, e.g. "Batteries / 電池".</summary>
    public string? SubLabel           { get; set; }
    /// <summary>Model self-reported confidence in the classification, 0..1.</summary>
    public double  Confidence         { get; set; }
}

/// <summary>
/// Request body for the expense-category AI assist endpoint: refine the name, translate to English,
/// and suggest a Form 990 line for an expense category (大項/小項) being defined or edited.
/// </summary>
public class ExpenseCategoryAiRequest
{
    /// <summary>The user-typed Chinese name (the primary input).</summary>
    public string  Name_zh             { get; set; } = "";
    /// <summary>The English name, if already typed (extra context for the model).</summary>
    public string? Name_en             { get; set; }
    /// <summary>"group" (大項) or "sub" (小項); selects the prompt framing.</summary>
    public string  Level               { get; set; } = "group";
    /// <summary>For a sub-category: the parent group's bilingual name, used for context.</summary>
    public string? ParentGroupName     { get; set; }
    /// <summary>For a sub-category: the parent group's mapped Form 990 line id, used to bias the choice.</summary>
    public int?    ParentForm990LineId { get; set; }
}

/// <summary>
/// AI suggestion for an expense category: a refined Chinese name, an English translation, and a
/// proposed Form 990 line. Line fields are null when the model returned an id outside the live catalog.
/// </summary>
public class CategoryAiSuggestion
{
    /// <summary>Typo-corrected, refined Traditional Chinese name.</summary>
    public string? ChineseName      { get; set; }
    public string? EnglishName      { get; set; }
    public int?    Form990LineId    { get; set; }
    /// <summary>Bilingual label of the suggested line, e.g. "16 — Occupancy / 場地".</summary>
    public string? Form990LineLabel { get; set; }
    /// <summary>Model self-reported confidence in the mapping, 0..1.</summary>
    public double  Confidence       { get; set; }
}
