using GraphQL.Types;

namespace Books.Api.GraphQL.InputTypes;

public class CreateFiscalYearInputType : InputObjectGraphType<CreateFiscalYearInput>
{
    public CreateFiscalYearInputType()
    {
        Name = "CreateFiscalYearInput";
        Description = "Input for creating a new fiscal year";

        Field(x => x.CompanyId).Description("Company ID (required)");
        Field(x => x.Name).Description("Fiscal year name, e.g., '2024' (required)");
        Field(x => x.StartDate).Description("First day of the fiscal year (required)");
        Field(x => x.EndDate).Description("Last day of the fiscal year (required)");
        Field(x => x.IsFirstFiscalYear, nullable: true)
            .Description("Set to true if this is the company's first fiscal year (allows 6-18 months duration)");
        Field(x => x.IsReorganization, nullable: true)
            .Description("Set to true if this is a reorganization fiscal year (allows up to 18 months duration)");
    }
}

public class CreateFiscalYearInput
{
    public string CompanyId { get; set; } = string.Empty;
    public string Name { get; set; } = string.Empty;
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }

    /// <summary>
    /// Per Årsregnskabsloven §15: First fiscal year can be shorter than 12 months (6-18 months allowed)
    /// </summary>
    public bool? IsFirstFiscalYear { get; set; }

    /// <summary>
    /// Per Årsregnskabsloven §15: Reorganization allows fiscal year up to 18 months
    /// </summary>
    public bool? IsReorganization { get; set; }
}
