/**
 * Generated by orval v8.9.1 🍺
 * Do not edit manually.
 * Api
 * نظام المحاسبة والمخازن
 * OpenAPI spec version: 0.1.0
 */
export interface HealthStatus {
  status: string;
}

export interface Supplier {
  id: number;
  name: string;
  /** @nullable */
  phone?: string | null;
  /** @nullable */
  address?: string | null;
  /** @nullable */
  notes?: string | null;
  balance?: number;
  createdAt: string;
}

export interface SupplierInput {
  name: string;
  phone?: string;
  address?: string;
  notes?: string;
}

export interface SupplierUpdate {
  name?: string;
  phone?: string;
  address?: string;
  notes?: string;
}

export type TransactionType = typeof TransactionType[keyof typeof TransactionType];


export const TransactionType = {
  receipt: 'receipt',
  payment: 'payment',
} as const;

export interface Transaction {
  id: number;
  type: TransactionType;
  date: string;
  documentNo: string;
  accountId: number;
  accountName: string;
  /** @nullable */
  supplierId?: number | null;
  /** @nullable */
  supplierName?: string | null;
  amount: number;
  /** @nullable */
  notes?: string | null;
  createdAt: string;
}

export interface SupplierStatement {
  supplier: Supplier;
  transactions: Transaction[];
  totalDebit: number;
  totalCredit: number;
  balance: number;
}

export interface Factory {
  id: number;
  name: string;
  /** @nullable */
  address?: string | null;
  /** @nullable */
  phone?: string | null;
  /** @nullable */
  notes?: string | null;
  createdAt: string;
}

export interface FactoryInput {
  name: string;
  address?: string;
  phone?: string;
  notes?: string;
}

export interface FactoryUpdate {
  name?: string;
  address?: string;
  phone?: string;
  notes?: string;
}

export interface Product {
  id: number;
  name: string;
  unit: string;
  createdAt: string;
}

export interface ProductInput {
  name: string;
  unit: string;
}

export interface ProductUpdate {
  name?: string;
  unit?: string;
}

export interface SupplyOrderItem {
  id: number;
  productId: number;
  productName: string;
  unit: string;
  quantity: number;
  unitPrice: number;
  total: number;
}

export interface SupplyOrder {
  id: number;
  supplierId: number;
  supplierName: string;
  factoryId: number;
  factoryName: string;
  date: string;
  documentNo: string;
  totalAmount: number;
  /** @nullable */
  notes?: string | null;
  items: SupplyOrderItem[];
  createdAt: string;
}

export interface SupplyOrderItemInput {
  productId: number;
  quantity: number;
  unitPrice: number;
}

export interface SupplyOrderInput {
  supplierId: number;
  factoryId: number;
  date: string;
  documentNo: string;
  notes?: string;
  items: SupplyOrderItemInput[];
}

export type AccountType = typeof AccountType[keyof typeof AccountType];


export const AccountType = {
  cash: 'cash',
  bank: 'bank',
  supplier: 'supplier',
  customer: 'customer',
  expense: 'expense',
  revenue: 'revenue',
  other: 'other',
} as const;

export interface Account {
  id: number;
  name: string;
  type: AccountType;
  balance: number;
  /** @nullable */
  notes?: string | null;
  createdAt: string;
}

export type AccountInputType = typeof AccountInputType[keyof typeof AccountInputType];


export const AccountInputType = {
  cash: 'cash',
  bank: 'bank',
  supplier: 'supplier',
  customer: 'customer',
  expense: 'expense',
  revenue: 'revenue',
  other: 'other',
} as const;

export interface AccountInput {
  name: string;
  type: AccountInputType;
  balance?: number;
  notes?: string;
}

export type AccountUpdateType = typeof AccountUpdateType[keyof typeof AccountUpdateType];


export const AccountUpdateType = {
  cash: 'cash',
  bank: 'bank',
  supplier: 'supplier',
  customer: 'customer',
  expense: 'expense',
  revenue: 'revenue',
  other: 'other',
} as const;

export interface AccountUpdate {
  name?: string;
  type?: AccountUpdateType;
  notes?: string;
}

export interface AccountStatement {
  account: Account;
  transactions: Transaction[];
  totalDebit: number;
  totalCredit: number;
  balance: number;
}

export type TransactionInputType = typeof TransactionInputType[keyof typeof TransactionInputType];


export const TransactionInputType = {
  receipt: 'receipt',
  payment: 'payment',
} as const;

export interface TransactionInput {
  type: TransactionInputType;
  date: string;
  documentNo: string;
  accountId: number;
  /** @nullable */
  supplierId?: number | null;
  amount: number;
  notes?: string;
}

export interface TransactionUpdate {
  date?: string;
  documentNo?: string;
  accountId?: number;
  /** @nullable */
  supplierId?: number | null;
  amount?: number;
  notes?: string;
}

export interface Payment {
  id: number;
  date: string;
  amount: number;
  accountId: number;
  accountName: string;
  /** @nullable */
  supplierId?: number | null;
  /** @nullable */
  supplierName?: string | null;
  /** @nullable */
  factoryId?: number | null;
  /** @nullable */
  factoryName?: string | null;
  /** @nullable */
  notes?: string | null;
  createdAt: string;
}

export interface PaymentInput {
  date: string;
  amount: number;
  accountId: number;
  /** @nullable */
  supplierId?: number | null;
  /** @nullable */
  factoryId?: number | null;
  notes?: string;
}

export interface DashboardSummary {
  totalSuppliers: number;
  totalFactories: number;
  totalSupplyOrders: number;
  totalSupplyAmount: number;
  totalReceipts: number;
  totalPayments: number;
  cashBalance: number;
  recentTransactions: Transaction[];
}

export interface SupplierSummaryItem {
  supplierId: number;
  supplierName: string;
  totalOrders: number;
  totalAmount: number;
  totalPaid: number;
  balance: number;
}

export interface FactorySummaryItem {
  factoryId: number;
  factoryName: string;
  totalOrders: number;
  totalAmount: number;
  totalItems: number;
}

export type GetSupplierStatementParams = {
supplierId: number;
/**
 * @nullable
 */
from?: string | null;
/**
 * @nullable
 */
to?: string | null;
};

export type ListSupplyOrdersParams = {
/**
 * @nullable
 */
supplierId?: number | null;
/**
 * @nullable
 */
factoryId?: number | null;
/**
 * @nullable
 */
from?: string | null;
/**
 * @nullable
 */
to?: string | null;
};

export type GetAccountStatementParams = {
accountId: number;
/**
 * @nullable
 */
from?: string | null;
/**
 * @nullable
 */
to?: string | null;
};

export type ListTransactionsParams = {
/**
 * @nullable
 */
type?: ListTransactionsType;
/**
 * @nullable
 */
accountId?: number | null;
/**
 * @nullable
 */
from?: string | null;
/**
 * @nullable
 */
to?: string | null;
};

export type ListTransactionsType = typeof ListTransactionsType[keyof typeof ListTransactionsType] | null;


export const ListTransactionsType = {
  receipt: 'receipt',
  payment: 'payment',
} as const;

export type ListPaymentsParams = {
/**
 * @nullable
 */
supplierId?: number | null;
/**
 * @nullable
 */
factoryId?: number | null;
};

