// 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"
}

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

enum webhookStatus {
  Accepted
  Pending
}

model WebhookOrderCre {
  id                                 Int           @id @default(autoincrement())
  address_line_1                     Json?
  address_line_2                     Json?
  assigned_company_gst               Json?
  assigned_company_name              Json?
  assigned_warehouse_id              Json?
  available_after                    Json?
  awb_number                         Json?
  batch_created_at                   Json?
  batch_id                           Json?
  billing_address_1                  Json?
  billing_address_2                  Json?
  billing_city                       Json?
  billing_country                    Json?
  billing_mobile                     Json?
  billing_name                       Json?
  billing_pin_code                   Json?
  billing_state                      Json?
  billing_state_code                 Json?
  blockSplit                         Json?
  breakup_types                      Json?
  buyer_gst                          Json?
  carrier_id                         Json?
  city                               Json?
  collectable_amount                 Json?
  company_name                       Json?
  contact_num                        Json?
  country                            Json?
  country_code                       Json?
  courier                            Json?
  courier_aggregator_name            Json?
  customer_code                      Json?
  customer_name                      Json?
  documents                          Json?
  easyecom_order_history             Json?
  email                              Json?
  fulfillable_status                 Json?
  import_date                        Json?
  invoice_currency_code              Json?
  invoice_date                       Json?
  invoice_documents                  Json?
  invoice_id                         BigInt   @unique 
  invoice_number                     Json?
  last_update_date                   Json?
  latitude                           Json?
  longitude                          Json?
  location_key                       Json?
  manifest_date                      Json?
  manifest_no                        Json?
  MarketCId                          Json?
  marketplace                        Json?
  marketplace_id                     Json?
  marketplace_invoice_num            Json?
  market_shipped                     Json?
  merchant_c_id                      Json?
  message                            Json?
  meta                               Json?
  order_date                         Json?
  order_id                           Json?
  order_items                        Json?
  order_quantity                     Json?
  order_status                       Json?
  order_status_id                    Json?
  order_type                         Json?
  order_type_key                     Json?
  order_validity_date                Json?
  originalOrderId                    Json?
  package_height                     Json?
  package_length                     Json?
  package_weight                     Json?
  package_width                      Json?
  packer                             Json?
  payment_gateway_transaction_number Json?
  payment_mode                       Json?
  payment_mode_id                    Json?
  picker                             Json?
  pickup_address                     Json?
  pickup_city                        Json?
  pickup_country                     Json?
  pickup_pin_code                    Json?
  pickup_state                       Json?
  pickup_state_code                  Json?
  pin_code                           Json?
  qcPassed                           Json?
  reference_code                     Json?
  replacement_order                  Json?
  salesmanUserId                     Json?
  seller_gst                         Json?
  shipping_history                   Json?
  shipping_last_update_date          Json?
  shipping_name                      Json?
  shipping_status                    Json?
  shipping_status_id                 Json?
  state                              Json?
  state_code                         Json?
  suborder_count                     Json?
  suborder_history                   Json?
  tat                                Json?
  tcs_amount                         Json?
  tcs_rate                           Json?
  total_amount                       Json?
  total_tax                          Json?
  tracking_url                       Json?
  warehouse_contact                  Json?
  warehouse_id                       Json?
  webhook                            Json?
  webhookStatus                      webhookStatus @default(Pending)
  createdAt                          DateTime      @default(now())
  updatedAt                          DateTime      @updatedAt
}

// this is for if order is not create then order coming from cache file

model CacheOrder {
  id        Int      @id @default(autoincrement())
  easycom   Json?
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}


model WebhookOrderMan {
  id                                 Int           @id @default(autoincrement())
  address_line_1                     Json?
  address_line_2                     Json?
  assigned_company_gst               Json?
  assigned_company_name              Json?
  assigned_warehouse_id              Json?
  available_after                    Json?
  awb_number                         Json?
  batch_created_at                   Json?
  batch_id                           Json?
  billing_address_1                  Json?
  billing_address_2                  Json?
  billing_city                       Json?
  billing_country                    Json?
  billing_mobile                     Json?
  billing_name                       Json?
  billing_pin_code                   Json?
  billing_state                      Json?
  billing_state_code                 Json?
  blockSplit                         Json?
  breakup_types                      Json?
  buyer_gst                          Json?
  carrier_id                         Json?
  city                               Json?
  collectable_amount                 Json?
  company_name                       Json?
  contact_num                        Json?
  country                            Json?
  country_code                       Json?
  courier                            Json?
  courier_aggregator_name            Json?
  customer_code                      Json?
  customer_name                      Json?
  documents                          Json?
  easyecom_order_history             Json?
  email                              Json?
  fulfillable_status                 Json?
  import_date                        Json?
  invoice_currency_code              Json?
  invoice_date                       Json?
  invoice_documents                  Json?
  invoice_id                         BigInt   @unique 
  invoice_number                     Json?
  last_update_date                   Json?
  latitude                           Json?
  longitude                          Json?
  location_key                       Json?
  manifest_date                      Json?
  manifest_no                        Json?
  MarketCId                          Json?
  marketplace                        Json?
  marketplace_id                     Json?
  marketplace_invoice_num            Json?
  market_shipped                     Json?
  merchant_c_id                      Json?
  message                            Json?
  meta                               Json?
  order_date                         Json?
  order_id                           Json?
  order_items                        Json?
  order_quantity                     Json?
  order_status                       Json?
  order_status_id                    Json?
  order_type                         Json?
  order_type_key                     Json?
  order_validity_date                Json?
  originalOrderId                    Json?
  package_height                     Json?
  package_length                     Json?
  package_weight                     Json?
  package_width                      Json?
  packer                             Json?
  payment_gateway_transaction_number Json?
  payment_mode                       Json?
  payment_mode_id                    Json?
  picker                             Json?
  pickup_address                     Json?
  pickup_city                        Json?
  pickup_country                     Json?
  pickup_pin_code                    Json?
  pickup_state                       Json?
  pickup_state_code                  Json?
  pin_code                           Json?
  qcPassed                           Json?
  reference_code                     Json?
  replacement_order                  Json?
  salesmanUserId                     Json?
  seller_gst                         Json?
  shipping_history                   Json?
  shipping_last_update_date          Json?
  shipping_name                      Json?
  shipping_status                    Json?
  shipping_status_id                 Json?
  state                              Json?
  state_code                         Json?
  suborder_count                     Json?
  suborder_history                   Json?
  tat                                Json?
  tcs_amount                         Json?
  tcs_rate                           Json?
  total_amount                       Json?
  total_tax                          Json?
  tracking_url                       Json?
  warehouse_contact                  Json?
  warehouse_id                       Json?
  webhook                            Json?
  webhookStatus                      webhookStatus @default(Pending)
  createdAt                          DateTime      @default(now())
  updatedAt                          DateTime      @updatedAt
}
