// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init


generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

enum Clickpost {
  Acccepted
  Pending
}

// model Order {
//   id                              Int       @id @default(autoincrement())
//   invoiceId                       Int
//   orderId                         Int
//   blockSplit                      Int
//   referenceCode                   String
//   companyName                     String
//   warehouseId                     Int
//   sellerGst                       String
//   assignedCompanyName             String
//   assignedWarehouseId             Int
//   assignedCompanyGst              String
//   warehouseContact                String?
//   pickupAddress                   String
//   pickupCity                      String
//   pickupState                     String
//   pickupStateCode                 String
//   pickupPinCode                   String
//   pickupCountry                   String
//   invoiceCurrencyCode             String
//   orderType                       String
//   orderTypeKey                    String
//   replacementOrder                Boolean
//   originalOrderId                 Int?
//   marketplace                     String
//   marketCId                       Int
//   marketplaceId                   Int
//   marketShipped                   Boolean
//   merchantCId                     Int
//   qcPassed                        Boolean
//   salesmanUserId                  Int
//   orderDate                       DateTime
//   tat                             DateTime
//   availableAfter                  DateTime?
//   invoiceDate                     DateTime
//   importDate                      DateTime
//   lastUpdateDate                  DateTime
//   manifestDate                    DateTime?
//   manifestNo                      String?
//   invoiceNumber                   String
//   marketplaceInvoiceNum           String?
//   shippingLastUpdateDate          DateTime
//   batchId                         Int?
//   batchCreatedAt                  DateTime?
//   message                         String?
//   courierAggregatorName           String
//   courier                         String
//   carrierId                       Int
//   awbNumber                       String
//   orderValidityDate               DateTime?
//   packageWeight                   Int
//   packageHeight                   Int
//   packageLength                   Int
//   packageWidth                    Int
//   orderStatus                     String
//   orderStatusId                   Int
//   suborderCount                   Int
//   shippingStatus                  String
//   shippingStatusId                Int
//   trackingUrl                     String?
//   paymentMode                     String
//   paymentModeId                   Int
//   paymentGatewayTransactionNumber String?
//   buyerGst                        String
//   customerName                    String
//   shippingName                    String
//   contactNum                      String
//   addressLine1                    String
//   addressLine2                    String
//   city                            String
//   pinCode                         String
//   state                           String
//   stateCode                       String
//   country                         String
//   countryCode                     String
//   email                           String
//   latitude                        Float
//   longitude                       Float
//   billingName                     String
//   billingAddress1                 String
//   billingAddress2                 String
//   billingCity                     String
//   billingState                    String
//   billingStateCode                String
//   billingPinCode                  String
//   billingCountry                  String
//   billingMobile                   String
//   orderQuantity                   Int
//   meta                            String?
//   invoiceDocuments                String?
//   collectableAmount               Float
//   totalAmount                     Float
//   totalTax                        Float
//   tcsRate                         Float
//   tcsAmount                       Float
//   customerCode                    String
//   fulfillableStatus               Boolean
//   clickPostStatus                 Clickpost @default(Pending)
//   cratedAt                        DateTime  @default(now())
//   updatedAt                       DateTime  @updatedAt
// }

model Order {
  id                                 Int       @id @default(autoincrement())
  invoice_id                         Int?
  order_id                           Int?
  queue_message                      String?
  queue_status                       Int?
  order_priority                     Int?
  blockSplit                         Int?
  reference_code                     String?
  company_name                       String?
  location_key                       String?
  warehouseId                        Int?
  seller_gst                         String?
  import_warehouse_id                Int?
  import_warehouse_name              String?
  pickup_address                     String?
  pickup_city                        String?
  pickup_state                       String?
  pickup_state_code                  String?
  pickup_pin_code                    String?
  pickup_country                     String?
  invoice_currency_code              String?
  order_type                         String?
  order_type_key                     String?
  replacement_order                  Int?
  originalOrderId                    Int?
  marketplace                        String?
  marketplace_id                     Int?
  qcPassed                           Int?
  salesmanUserId                     Int?
  order_date                         String?
  tat                                String?
  available_after                    String?
  invoice_date                       String?
  import_date                        String?
  last_update_date                   String?
  manifest_date                      String?
  manifest_no                        String?
  invoice_number                     String?
  marketplace_invoice_num            String?
  shipping_last_update_date          String?
  batch_id                           String?
  batch_created_at                   String?
  message                            String?
  courier_aggregator_name            String?
  courier                            String?
  carrier_id                         Int?
  awb_number                         String?
  order_status                       String?
  order_status_id                    Int?
  suborder_count                     Int?
  shipping_status                    String?
  shipping_status_id                 Int?
  shipping_history                   String?
  delivery_date                      String?
  payment_mode                       String?
  payment_mode_id                    Int?
  payment_gateway_transaction_number String?
  payment_gateway_name               String?
  buyer_gst                          String?
  customer_name                      String?
  contact_num                        String?
  address_line_1                     String?
  address_line_2                     String?
  city                               String?
  pin_code                           String?
  state                              String?
  state_code                         String?
  country                            String?
  email                              String?
  latitude                           String?
  longitude                          String?
  billing_name                       String?
  billing_address_1                  String?
  billing_address_2                  String?
  billing_city                       String?
  billing_state                      String?
  billing_state_code                 String?
  billing_pin_code                   String?
  billing_country                    String?
  billing_mobile                     String?
  order_quantity                     Int?
  meta                               Json?
  documents                          Json?
  total_amount                       Float?
  total_tax                          Float?
  total_shipping_charge              Float?
  total_discount                     Float?
  collectable_amount                 Float?
  tcs_rate                           Float?
  tcs_amount                         Float?
  customer_code                      String?
  clickPostStatus                    Clickpost @default(Pending)
  cratedAt                           DateTime  @default(now())
  updatedAt                          DateTime  @updatedAt
}

model LastSyncLogTime {
  id        Int      @id @default(autoincrement())
  lastSync  DateTime
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
