namespace JobTrackerApi.Models;

// Phase 5 — AI Career Assistant. Append-only history of every AI interaction for a job application.
// Unlike AiWorkspaceNote (one row per (owner, job, type), overwritten on regenerate — a cache), this
// keeps EVERY generation so the user can restore, compare, reuse, or delete past outputs. Suggestion
// only: an interaction never mutates the master profile, a CV variant, or the application itself.
// docs/architecture/ai-career-assistant.md.
public sealed class AiInteraction
{
    public int Id { get; set; }
    public string OwnerUserId { get; set; } = string.Empty;
    public int JobApplicationId { get; set; }
    public JobApplication? JobApplication { get; set; }

    // job-analysis | career-match | cover-letter | interview | application-review
    public string Module { get; set; } = string.Empty;

    // Optional mode within a module (e.g. cover-letter: professional|friendly|short|detailed|modern|traditional).
    public string? Mode { get; set; }

    // Human label for the history list, e.g. "Cover letter · Professional".
    public string Title { get; set; } = string.Empty;

    // Resolved provider label at generation time (transparency for the history list).
    public string Provider { get; set; } = string.Empty;

    // The generated suggestion. { text: string, meta?: object } — text is markdown the UI renders;
    // meta carries any structured extras (e.g. career-match percent).
    public string ResultJson { get; set; } = string.Empty;

    // Provider-neutral usage meter. Token count is estimated because the sidecar currently returns text only.
    public int InputCharacterCount { get; set; }
    public int OutputCharacterCount { get; set; }
    public int EstimatedTokenCount { get; set; }

    public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}
