/**
 * Sales Module Exports
 * Central entry point for the sales module
 */

// Domain
export type {
  SalesInvoice,
  SalesInvoiceItem,
  SalesInvoicePaymentMethod,
  SalesInvoiceDocument,
  SalesInvoiceLogEntry,
  CreateSalesInvoiceRecord,
  SalesInvoiceStatus,
  SalesInvoicePaymentStatus,
  SalesInvoicePostingStatus,
  SalesInvoiceShippingStatus,
  PaymentMethod,
  TaxMethod,
} from './domain/sales-invoice.model';

export {
  calculateSalesInvoiceTotals,
  validateSalesInvoice,
  calculatePaymentStatus,
  calculateAmountDue,
  validateDiscountPercentage,
  canCancelInvoice,
  canEditInvoice,
} from './domain/sales-invoice.domain';

// Sales Return Domain
export type {
  SalesReturn,
  SalesReturnItem,
  SalesReturnDocument,
  SalesReturnLogEntry,
  CreateSalesReturnRecord,
  ApproveSalesReturnRecord,
  ReceiveSalesReturnRecord,
  ProcessSalesReturnRecord,
  RejectSalesReturnRecord,
  SalesReturnStatus,
  SalesReturnReason,
} from './domain/sales-return.model';

export {
  calculateSalesReturnTotals,
  validateReturnAgainstInvoice,
  canApproveReturn,
  canReceiveReturn,
  canProcessReturn,
  canRejectReturn,
  canCancelReturn,
  calculateRefundAmount,
  buildCreditNoteItemsFromReturn,
} from './domain/sales-return.domain';

// Application
export type { SalesInvoiceRepository } from './application/sales-invoice-repository';

// Sales Return Application
export type { SalesReturnRepository } from './application/sales-return-repository';
export type { SalesReturnAccountingPort } from './application/sales-return-accounting.port';
export type { SalesReturnSideEffectsPort } from './application/sales-return-side-effects.port';
export type { SalesReturnReferenceDataPort } from './application/sales-return-reference-data.port';
export type { SalesReturnIdGeneratorPort } from './application/sales-return-id-generator.port';
export {
  SalesReturnApplicationService,
  type CreateSalesReturnInput,
  type ApproveSalesReturnInput,
  type ReceiveSalesReturnInput,
  type ProcessSalesReturnInput,
  type RejectSalesReturnInput,
} from './application/sales-return-application-service';
export type { SalesAccountingPort } from './application/sales-accounting.port';
export type { SalesSideEffectsPort } from './application/sales-side-effects.port';
export type {
  SalesReferenceDataPort,
  Customer,
  Material,
  Warehouse,
  Currency,
  SalesRep,
} from './application/sales-reference-data.port';
export type { SalesIdGeneratorPort } from './application/sales-id-generator.port';
export {
  SalesInvoiceApplicationService,
  type CreateSalesInvoiceInput,
} from './application/sales-invoice-application-service';

// Infrastructure
export { SalesInvoiceJsonAdapter } from './infrastructure/sales-invoice-json-adapter';
export { DefaultSalesAccountingPort } from './infrastructure/default-sales-accounting.port';
export { DefaultSalesSideEffectsPort } from './infrastructure/default-sales-side-effects.port';
export { DefaultSalesReferenceDataPort } from './infrastructure/default-sales-reference-data.port';
export { DefaultSalesIdGeneratorPort } from './infrastructure/default-sales-id-generator.port';
export {
  createSalesInvoiceService,
  getSalesInvoiceService,
  resetSalesInvoiceService,
} from './infrastructure/sales-module-factory';

// Sales Return Infrastructure
export { JsonSalesReturnRepository } from './infrastructure/json-sales-return-repository';
export { DefaultSalesReturnAccountingPort } from './infrastructure/default-sales-return-accounting.port';
export { DefaultSalesReturnSideEffectsPort } from './infrastructure/default-sales-return-side-effects.port';
export { DefaultSalesReturnReferenceDataPort } from './infrastructure/default-sales-return-reference-data.port';
export { DefaultSalesReturnIdGeneratorPort } from './infrastructure/default-sales-return-id-generator.port';
export { createSalesReturnService } from './infrastructure/sales-return-factory';
