using ROLAC.API.Entities.Base;
namespace ROLAC.API.Entities;

/// <summary>
/// Singleton (Id == 1) holding the issuing church's identity, bank details, and the
/// running check-number counter used when disbursing checks. Seeded on startup.
/// </summary>
public class ChurchProfile : AuditableEntity, IAuditable
{
    public int     Id                { get; set; }
    public string  Name              { get; set; } = null!;
    public string? NameZh            { get; set; }
    public string? Phone             { get; set; }
    public string? Email             { get; set; }
    public string? Website           { get; set; }
    public string? Address           { get; set; }
    public string? City              { get; set; }
    public string? State             { get; set; }
    public string? ZipCode           { get; set; }
    public string? BankName          { get; set; }
    public string? BankAccountNumber { get; set; }
    public string? BankRoutingNumber { get; set; }

    /// <summary>Payer EIN printed on Form 1099-NEC Copy B; the church's own public business identifier.</summary>
    public string? PayerEin          { get; set; }

    // ── AI assist provider settings (editable via Church Profile → AI 設定 tab) ──
    public string  AiProvider   { get; set; } = "Claude";   // "Claude" | "Gemini"
    public string? ClaudeModel  { get; set; } = "claude-haiku-4-5-20251001";
    public string? ClaudeApiKey { get; set; }                // secret, stored plaintext
    public string? GeminiModel  { get; set; } = "gemini-2.5-flash-lite";
    public string? GeminiApiKey { get; set; }                // secret, stored plaintext

    /// <summary>Next check number to allocate; consumed (++) when a check is issued.</summary>
    public int     NextCheckNumber   { get; set; } = 1001;

    // Npgsql system column used as an optimistic-concurrency token so two simultaneous
    // disbursement runs can't allocate the same check number. Mapped via IsRowVersion().
    public uint    xmin              { get; set; }
}
