package models

// ============================================================
// 🧾 ORDER HEADER
// ============================================================
type OrderHeader struct {
	OrderHeaderID string `json:"OrderHeaderID"`

	OrderTypeCode NullInt16  `json:"OrderTypeCode"`
	ProcessCode   NullString `json:"ProcessCode"`
	OrderNumber   NullString `json:"OrderNumber"`
	IsCancelOrder NullBool   `json:"IsCancelOrder"`

	// 🔥 Date & Time string olarak geliyor (frontend)
	OrderDate NullString `json:"OrderDate"` // "YYYY-MM-DD"
	OrderTime NullString `json:"OrderTime"` // "HH:mm:ss"

	DocumentNumber NullString `json:"DocumentNumber"`

	PaymentTerm    NullInt16  `json:"PaymentTerm"`
	AverageDueDate NullString `json:"AverageDueDate"` // "YYYY-MM-DD"

	Description         NullString `json:"Description"`
	InternalDescription NullString `json:"InternalDescription"`

	CurrAccTypeCode NullInt16  `json:"CurrAccTypeCode"`
	CurrAccCode     NullString `json:"CurrAccCode"`

	CurrAccDescription NullString `json:"CurrAccDescription"`

	// 🔥 GUID alanları NullUUID yapıldı
	SubCurrAccID            NullUUID   `json:"SubCurrAccID"`
	ContactID               NullUUID   `json:"ContactID"`
	ShipmentMethodCode      NullString `json:"ShipmentMethodCode"`
	ShippingPostalAddressID NullUUID   `json:"ShippingPostalAddressID"`
	BillingPostalAddressID  NullUUID   `json:"BillingPostalAddressID"`
	GuarantorContactID      NullUUID   `json:"GuarantorContactID"`
	GuarantorContactID2     NullUUID   `json:"GuarantorContactID2"`

	RoundsmanCode       NullString `json:"RoundsmanCode"`
	DeliveryCompanyCode NullString `json:"DeliveryCompanyCode"`

	TaxTypeCode            NullInt16  `json:"TaxTypeCode"`
	WithHoldingTaxTypeCode NullString `json:"WithHoldingTaxTypeCode"`
	DOVCode                NullString `json:"DOVCode"`
	TaxExemptionCode       NullInt16  `json:"TaxExemptionCode"`

	CompanyCode   NullInt32  `json:"CompanyCode"`
	OfficeCode    NullString `json:"OfficeCode"`
	StoreTypeCode NullInt16  `json:"StoreTypeCode"`
	StoreCode     NullString `json:"StoreCode"`

	POSTerminalID   NullInt16  `json:"POSTerminalID"`
	WarehouseCode   NullString `json:"WarehouseCode"`
	ToWarehouseCode NullString `json:"ToWarehouseCode"`

	OrdererCompanyCode NullInt32  `json:"OrdererCompanyCode"`
	OrdererOfficeCode  NullString `json:"OrdererOfficeCode"`
	OrdererStoreCode   NullString `json:"OrdererStoreCode"`

	GLTypeCode        NullString  `json:"GLTypeCode"`
	DocCurrencyCode   NullString  `json:"DocCurrencyCode"`
	LocalCurrencyCode NullString  `json:"LocalCurrencyCode"`
	ExchangeRate      NullFloat64 `json:"ExchangeRate"`

	TDisRate1 NullFloat64 `json:"TDisRate1"`
	TDisRate2 NullFloat64 `json:"TDisRate2"`
	TDisRate3 NullFloat64 `json:"TDisRate3"`
	TDisRate4 NullFloat64 `json:"TDisRate4"`
	TDisRate5 NullFloat64 `json:"TDisRate5"`

	DiscountReasonCode           NullInt16   `json:"DiscountReasonCode"`
	SurplusOrderQtyToleranceRate NullFloat64 `json:"SurplusOrderQtyToleranceRate"`

	ImportFileNumber      NullString `json:"ImportFileNumber"`
	ExportFileNumber      NullString `json:"ExportFileNumber"`
	IncotermCode1         NullString `json:"IncotermCode1"`
	IncotermCode2         NullString `json:"IncotermCode2"`
	LettersOfCreditNumber NullString `json:"LettersOfCreditNumber"`
	PaymentMethodCode     NullString `json:"PaymentMethodCode"`

	IsInclutedVat         NullBool `json:"IsInclutedVat"`
	IsCreditSale          NullBool `json:"IsCreditSale"`
	IsCreditableConfirmed NullBool `json:"IsCreditableConfirmed"`

	CreditableConfirmedUser NullString `json:"CreditableConfirmedUser"`
	// MSSQL datetime
	CreditableConfirmedDate CustomTime `json:"CreditableConfirmedDate"`

	IsSalesViaInternet NullBool `json:"IsSalesViaInternet"`
	IsSuspended        NullBool `json:"IsSuspended"`
	IsCompleted        NullBool `json:"IsCompleted"`
	IsPrinted          NullBool `json:"IsPrinted"`
	IsLocked           NullBool `json:"IsLocked"`
	UserLocked         NullBool `json:"UserLocked"`
	IsClosed           NullBool `json:"IsClosed"`

	ApplicationCode NullString `json:"ApplicationCode"`
	ApplicationID   NullUUID   `json:"ApplicationID"`

	CreatedUserName NullString `json:"CreatedUserName"`
	// Frontend "YYYY-MM-DD HH:mm:ss" gönderiyor
	CreatedDate NullString `json:"CreatedDate"`

	LastUpdatedUserName NullString `json:"LastUpdatedUserName"`
	LastUpdatedDate     NullString `json:"LastUpdatedDate"`

	IsProposalBased NullBool `json:"IsProposalBased"`
}
