using Books.Api.Domain.Accounts;
using Books.Api.GraphQL.Types;
using GraphQL.Types;

namespace Books.Api.GraphQL.InputTypes;

public class CreateAccountInputType : InputObjectGraphType<CreateAccountInput>
{
    public CreateAccountInputType()
    {
        Name = "CreateAccountInput";
        Description = "Input for creating a new account";

        Field(x => x.CompanyId).Description("Company ID (required)");
        Field(x => x.AccountNumber).Description("Account number, 4-10 digits (required)");
        Field(x => x.Name).Description("Account name (required)");
        Field<NonNullGraphType<AccountTypeEnumType>>("accountType")
            .Description("Type of account (required)");
        Field(x => x.ParentId, nullable: true).Description("Parent account ID for hierarchy");
        Field(x => x.Description, nullable: true).Description("Account description");
        Field(x => x.VatCodeId, nullable: true).Description("Default VAT code ID");
        Field(x => x.IsSystemAccount, nullable: true).Description("Whether this is a system account (default: false)");
        Field(x => x.StandardAccountNumber, nullable: true).Description("Erhvervsstyrelsens standardkontonummer for SAF-T rapportering");
    }
}

public class CreateAccountInput
{
    public string CompanyId { get; set; } = string.Empty;
    public string AccountNumber { get; set; } = string.Empty;
    public string Name { get; set; } = string.Empty;
    public AccountType AccountType { get; set; }
    public string? ParentId { get; set; }
    public string? Description { get; set; }
    public string? VatCodeId { get; set; }
    public bool? IsSystemAccount { get; set; }
    /// <summary>
    /// Erhvervsstyrelsens standardkontonummer for SAF-T rapportering.
    /// </summary>
    public string? StandardAccountNumber { get; set; }
}
