enum InvoiceStatus {
  PAID
  PENDING
  OVERDUE
  PENDING_REVIEW 
  APPROVED 
  DISPUTED
  DRAFT
}

enum InovicePaymentTerms{
  NET_30
  NET_45
  NET_60
}

type Invoice @table(name: "invoices") {
  id: UUID! @default(expr: "uuidV4()")

  status: InvoiceStatus!

  #vendor poner companyName
  vendorId: UUID!
  vendor: Vendor! @ref(fields: "vendorId", references: "id") 

  #businnes poner businessName
  businessId: UUID!
  business: Business! @ref(fields: "businessId", references: "id") 

  #order poner eventName
  orderId: UUID!
  order: Order! @ref(fields: "orderId", references: "id")

  #web
  paymentTerms: InovicePaymentTerms
  invoiceNumber: String!
  issueDate: Timestamp!
  dueDate: Timestamp!
  hub: String
  managerName: String
  vendorNumber: String
  roles: Any #here is for staff
  charges: Any
  otherCharges: Float
  subtotal: Float
  amount: Float!
  notes: String

  staffCount: Int 
  chargesCount: Int

  #DISPUTED
  disputedItems: Any @col(dataType: "jsonb")
  disputeReason: String
  disputeDetails: String

  createdAt: Timestamp @default(expr: "request.time")
  updatedAt: Timestamp @default(expr: "request.time")
  createdBy: String
}
