using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using CliFx.Infrastructure;

namespace AaLog.Cli.Commands
{
    /// Quick field-reference printout so an agent can discover output shape without
    /// having to read the docs/ folder. Mirrors LogRecordDto exactly.
    [Command("fields", Description = "Print the LogRecord JSON field reference and exit.")]
    public sealed class FieldsCommand : ICommand
    {
        public ValueTask ExecuteAsync(IConsole console)
        {
            console.Output.WriteLine("LogRecord fields emitted by aalog (subset of aaLogReader.LogRecord):");
            console.Output.WriteLine();
            console.Output.WriteLine("  MessageNumber   ulong   Monotonic record id assigned by the logger.");
            console.Output.WriteLine("  TimestampUtc    string  Event time, ISO-8601 with Z suffix.");
            console.Output.WriteLine("  TimestampLocal  string  Event time in the host's local zone, ISO-8601.");
            console.Output.WriteLine("  Level           string  LogFlag value: Info, Warning, Error, Trace, ...");
            console.Output.WriteLine("  Component       string  Originating component (e.g. Bootstrap, aaEngine).");
            console.Output.WriteLine("  ProcessName     string  Process that emitted the record.");
            console.Output.WriteLine("  ProcessId       uint    OS process id.");
            console.Output.WriteLine("  ThreadId        uint    OS thread id.");
            console.Output.WriteLine("  SessionId       string  Session id, when present.");
            console.Output.WriteLine("  Host            string  Host FQDN at time of emission.");
            console.Output.WriteLine("  Message         string  Free-form message body.");
            console.Output.WriteLine();
            console.Output.WriteLine("LLM-JSON envelope shape: { query: {...}, count: N, records: [LogRecord, ...] }");
            return default;
        }
    }
}
