/**
 * Vendor/supplier shared types — vendors-suppliers (wave-11 leaf-E).
 */

export interface Vendor {
  id: string
  tenantId: string
  name: string
  taxId: string | null
  withholdingRate: string | null
  withholdingCertNumber: string | null
  withholdingCertExpiry: string | null
  withholdingCertR2Key: string | null
  defaultCategory: string | null
  defaultVatDeductible: boolean
  paymentTermsDays: number
  email: string | null
  phone: string | null
  address: string | null
  notes: string | null
  isArchived: boolean
  createdAt: string
  updatedAt: string
  ytdSpend: string
  expenseCount: number
  linkedExpensesTotal: string
  expenses: VendorLinkedExpense[]
}

export interface VendorLinkedExpense {
  id: string
  expenseDate: string | null
  amount: string | null
  currency: string
  category: string | null
  status: string
  vendorName: string | null
}

export interface VendorListItem {
  id: string
  name: string
  taxId: string | null
  withholdingRate: string | null
  withholdingCertExpiry: string | null
  isArchived: boolean
  ytdSpend: string
  certExpiringSoon: boolean
}

export interface VendorSuggestion {
  id: string
  name: string
  taxId: string | null
}

export interface CreateVendorBody {
  name: string
  taxId?: string
  withholdingRate?: number | null
  withholdingCertNumber?: string
  withholdingCertExpiry?: string
  defaultCategory?: string
  defaultVatDeductible?: boolean
  paymentTermsDays?: number
  email?: string
  phone?: string
  address?: string
  notes?: string
}

export interface UpdateVendorBody extends Partial<CreateVendorBody> {}
