using Books.Api.EventFlow.ReadModels;
using GraphQL.Types;

namespace Books.Api.GraphQL.Types;

public class CustomerGraphType : ObjectGraphType<CustomerReadModelDto>
{
    public CustomerGraphType()
    {
        Name = "Customer";
        Description = "A customer for invoicing (B2B or B2C)";

        Field(x => x.Id).Description("Unique identifier");
        Field(x => x.CompanyId).Description("Company this customer belongs to");
        Field(x => x.CustomerNumber).Description("Customer number (e.g., 0001)");
        Field(x => x.CustomerType).Description("Type: Business (B2B) or Private (B2C)");
        Field(x => x.Name).Description("Customer name");
        Field(x => x.Cvr, nullable: true).Description("CVR number (required for Business customers)");
        Field(x => x.Address, nullable: true).Description("Street address");
        Field(x => x.PostalCode, nullable: true).Description("Postal code");
        Field(x => x.City, nullable: true).Description("City");
        Field(x => x.Country).Description("Country code (ISO 2-letter, default: DK)");
        Field(x => x.Email, nullable: true).Description("Email address");
        Field(x => x.Phone, nullable: true).Description("Phone number");
        Field(x => x.PaymentTermsDays).Description("Payment terms in days (default: 30)");
        Field(x => x.DefaultRevenueAccountId, nullable: true).Description("Default revenue account for invoices");
        Field(x => x.SubLedgerAccountId).Description("Sub-ledger account ID (1900-XXXX)");
        Field(x => x.IsActive).Description("Whether the customer is active");
        Field(x => x.CreatedAt).Description("When the customer was created");
        Field(x => x.UpdatedAt).Description("When the customer was last updated");
    }
}

public class CustomerTypeEnumType : EnumerationGraphType<Domain.Customers.CustomerType>
{
    public CustomerTypeEnumType()
    {
        Name = "CustomerType";
        Description = "Type of customer";
    }
}
