using Books.Api.Reporting;
using GraphQL.Types;

namespace Books.Api.GraphQL.Types;

/// <summary>
/// GraphQL type for VAT (moms) reports.
/// Represents SKAT VAT declaration boxes and summary.
/// </summary>
public class VatReportType : ObjectGraphType<VatReportDto>
{
    public VatReportType()
    {
        Name = "VatReport";
        Description = "VAT (moms) report for SKAT compliance";

        // SKAT boxes (VAT amounts)
        Field(x => x.BoxA).Description("Rubrik A: Salgsmoms - Output VAT from domestic sales (25%)");
        Field(x => x.BoxB).Description("Rubrik B: Købsmoms - Input VAT deduction from purchases (25%)");
        Field(x => x.BoxC).Description("Rubrik C: EU-varekøb moms - VAT on goods from EU (reverse charge)");
        Field(x => x.BoxD).Description("Rubrik D: Ydelseskøb moms - VAT on services from abroad (reverse charge)");

        // Basis/turnover fields
        Field(x => x.Basis1).Description("Felt 1: Salg med moms - Turnover with VAT (domestic)");
        Field(x => x.Basis2).Description("Felt 2: Salg uden moms - Turnover without VAT (exports, exempt)");
        Field(x => x.Basis3).Description("Felt 3: EU-varekøb - Purchases of goods from EU");
        Field(x => x.Basis4).Description("Felt 4: Ydelseskøb fra udland - Purchases of services from abroad");

        // Summary
        Field(x => x.TotalOutputVat).Description("Total output VAT (A + C + D)");
        Field(x => x.TotalInputVat).Description("Total input VAT (B - deductible)");
        Field(x => x.NetVat).Description("Net VAT to pay/receive (positive = pay, negative = refund)");

        // Period info
        Field(x => x.PeriodStart, type: typeof(DateOnlyGraphType)).Description("Start date of the VAT period");
        Field(x => x.PeriodEnd, type: typeof(DateOnlyGraphType)).Description("End date of the VAT period");
        Field(x => x.TransactionCount).Description("Number of transactions with VAT in the period");
    }
}
