generator client {
  provider = "prisma-client"
  output   = "generated/prisma/client/mariadb"
}

datasource db {
  provider = "mysql"
}

model account {
  id                BigInt  @id @default(autoincrement())
  customer_id       String? @db.VarChar(32)  //variable string, composition varies a lot, used by customers to identify their account
  date_orig         BigInt?                  //timestamp
  date_last         BigInt?                  //timestamp
  date_expire       BigInt?                  //not used
  language_id       String  @default(dbgenerated("(francais)")) @db.VarChar(32) //either "anglais", "francais"
  country_id        Int     @default(124)    //124 (canada), 450 (Madagascar) or 840 (Virgin island)
  currency_id       Int?                     //not used
  username          String? @db.VarChar(128)
  password          String? @db.VarChar(128)
  group_id          Int     @default(6) @db.TinyInt //refers to the account_group table
  misc              String? @db.VarChar(128) //comments of some sort
  status            Int?                     //1-actif, 2-suspension,3- non paiement, 4- terminé, 5- recouvre, 6-creance
  first_name        String? @db.VarChar(128)
  middle_name       String? @db.VarChar(128) //not used
  last_name         String? @db.VarChar(128) 
  mandataire        String? @db.VarChar(128) //sometimes the first_name and last_name are found here, sometimes its the name of someone who manage the account
  title             String? @db.VarChar(128) //Mme, Mrs, Mr., M., ""
  email             String? @db.VarChar(255)
  email_autre       String? @db.VarChar(255) //second email
  company           String? @db.VarChar(255) //name of the company account
  contact           String  @db.Text         //name of the contact at the company or account contact
  address1          String? @db.VarChar(128) 
  address2          String? @db.VarChar(128) //sometimes used to specify the unit, the suit, the camping lot or used as a note???
  city              String? @db.VarChar(128)
  state             String? @db.VarChar(32)
  zip               String? @db.VarChar(16)
  tel_home          String? @db.VarChar(16)
  tel_office        String? @db.VarChar(16)
  tel_office_ext    String? @db.VarChar(4)
  cell              String? @db.VarChar(16)
  fax               String? @db.VarChar(16)
  invoice_delivery  Int     @default(2)     //1-email, 2-poste, 3-default
  land_owner        Boolean @default(false) //tinyInt boolean
  frais             Boolean @default(false) //tinyInt boolean
  ppa               Boolean @default(false)
  ppa_all_invoice   Int     @default(0) @db.TinyInt
  ppa_name          String? @db.VarChar(64)
  ppa_code          String? @db.VarChar(255)
  ppa_branch        String? @db.VarChar(255)
  ppa_account       String? @db.VarChar(255)
  ppa_amount        Decimal @default(0.00) @db.Decimal(6, 2)
  ppa_amount_buffer Float   @default(30.00)
  ppa_all_tmp       Int     @default(0) @db.TinyInt
  ppa_fixed         Boolean @default(false)
  commercial        Boolean @default(false)
  vip               Boolean @default(false)
  tax_group         Int     @default(1) @db.TinyInt
  data_check        Boolean @default(false)
  created_by        Int?
  notes_client      String? @db.VarChar(256) //comments left by customer via the "portail"
  keyword           String? @db.VarChar(512)
  terminate_reason  String? @db.VarChar(32) //install,demenage, cie, autre, NULL
  terminate_cie     String? @db.VarChar(32) // null, bell, autre, videotron, cogeco, deery, explirnet, sftl, haut-richelieu
  terminate_note    String? @db.MediumText  // comment on the termination of the account
  terminate_date    String? @db.VarChar(16)
  call              Boolean @default(false) //tinyInt boolean
  pub               Boolean @default(true)  //TinyInt boolean
  portal_client_log Boolean @default(false) //TinyInt boolean
  mauvais_payeur    Boolean @default(false) //TinyInt boolean
  renew_phone       Boolean @default(false) //TinyInt boolean
  ppa_cc            Int     @default(0) @db.TinyInt
  stripe_id         String? @db.VarChar(32)

  @@index([customer_id], map: "customer_id")
  @@index([id, status], map: "id")
  @@index([status], map: "status")
}

model account_group {
  id         Int     @id @default(autoincrement()) @db.TinyInt //see group_id in account table for references
  date_orig  BigInt?
  group_name String? @db.VarChar(64) //group name
}

// this table could be ignored ? see comment on memo column
model account_memo {
  id           BigInt  @id @default(autoincrement())
  date_orig    BigInt?
  last_updated BigInt  @default(0) @db.UnsignedBigInt
  staff_id     BigInt? 
  account_id   BigInt?
  memo         String? @db.VarChar(1024) //comment, seems to be a copy paste of a form, giving a bunch of infos on the account, should be queried instead of copied
  color        String  @default(dbgenerated("(000000)")) @db.VarChar(6) //CSS
  bcolor       String  @default(dbgenerated("(E0E0E0)")) @db.VarChar(6) //CSS
  border       String  @default(dbgenerated("(000000)")) @db.VarChar(6) //CSS

  @@index([account_id], map: "account_id")
  @@index([staff_id], map: "staff_id")
}


model compta_comptes {
  id         BigInt  @id @default(autoincrement())
  category   String? @db.VarChar(64)
  num_compte String? @db.VarChar(16)
  desc       String? @db.MediumText
}

model compta_comptes_soldes {
  id         BigInt @id @default(autoincrement())
  num_compte Int
  year       Int
  amount     Float  @db.Float
  comment    String @db.VarChar(64)
  type       String @db.VarChar(3)
}

model compta_journal_ecriture {
  id          BigInt  @id @default(autoincrement())
  date_orig   BigInt?
  type        String? @db.VarChar(4)
  num         BigInt?
  customer_id String? @db.VarChar(32)
  full_name   String? @db.VarChar(256)
  desc        String? @db.MediumText
  mo          String? @db.VarChar(4)
  em          Int     @default(0) @db.TinyInt

  @@index([customer_id], map: "customer_id")
  @@index([date_orig], map: "date_orig")
  @@index([num], map: "num")
}

model compta_journal_ecriture_bk {
  id          BigInt  @id @default(autoincrement())
  date_orig   BigInt?
  type        String? @db.VarChar(4)
  num         BigInt?
  customer_id String? @db.VarChar(32)
  full_name   String? @db.VarChar(256)
  desc        String? @db.MediumText
  mo          String? @db.VarChar(4)
  em          Int     @default(0) @db.TinyInt

  @@index([customer_id], map: "customer_id")
  @@index([date_orig], map: "date_orig")
  @@index([num], map: "num")
}

model compta_journal_ecriture_detail {
  id         BigInt  @id @default(autoincrement())
  journal_id BigInt?
  num_compte BigInt?
  amount     Float?
  action     String? @db.VarChar(16)

  @@index([journal_id], map: "journal_id")
}

model compta_journal_ecriture_detail_bk {
  id         BigInt  @id @default(autoincrement())
  journal_id BigInt?
  num_compte BigInt?
  amount     Float?
  action     String? @db.VarChar(16)

  @@index([journal_id], map: "journal_id")
}

model compta_periode {
  month Int @id @default(7)
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model compta_ppa_file_id {
  last_id Int @id @default(1)
}

model compta_setup {
  setup_id        Int     @id @default(1)
  period_month    Int     @default(7)
  ppa_id          Int     @default(1)
  excedent_max    Float   @default(0)
  month_closed    BigInt?
  pay_week_closed Int     @db.UnsignedTinyInt
  attachment_ext  String  @db.MediumText
  netadmin_dispo  Int     @default(0) @db.UnsignedInt
  imap_token      String? @db.Text
}

model credit_code {
  id   Int    @id @default(autoincrement())
  code String @db.VarChar(16)
  desc String @db.VarChar(256)
}

model tax {
  id          Int     @id @default(autoincrement())
  name        String? @db.VarChar(128)
  description String? @db.VarChar(255)
  rate        Float?
}

model tax_group {
  id          Int     @id @default(autoincrement())
  name        String? @db.VarChar(128)
  description String? @db.VarChar(255)
  tax         String? @db.VarChar(128)
}

model td_payable {
  id            Int     @id @default(autoincrement()) @db.UnsignedInt
  ticket_id     Int     @default(0) @db.UnsignedInt
  invoice       String  @default(dbgenerated("()")) @db.VarChar(32)
  date_invoice  String  @db.VarChar(20)
  fournisseur   String? @default(dbgenerated("()")) @db.VarChar(128)
  montant       Decimal @default(0.00) @db.Decimal(15, 2)
  devise        String  @default(dbgenerated("(ca)")) @db.VarChar(2)
  methode       String? @default(dbgenerated("()")) @db.VarChar(64)
  reference     String? @default(dbgenerated("()")) @db.VarChar(128)
  date_paiement String? @default(dbgenerated("()")) @db.VarChar(20)
  releve        String? @db.VarChar(128)

  @@index([ticket_id], map: "ticket_id")
}

model conso {
  id          BigInt  @id @default(autoincrement())
  ip_id       String? @db.VarChar(16)
  date        BigInt?
  total       BigInt? @default(0)
  total_day   BigInt? @default(0)
  total_night BigInt? @default(0)

  @@index([ip_id], map: "ip_id")
}

model conso_archive {
  id          BigInt  @id @default(autoincrement())
  ip_id       String? @db.VarChar(16)
  date        BigInt?
  total       BigInt? @default(0)
  total_day   BigInt? @default(0)
  total_night BigInt? @default(0)

  @@index([ip_id], map: "ip_id")
}

model conso_avis {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  date        BigInt
  account_id  Int    @db.UnsignedInt
  delivery_id Int    @default(0) @db.UnsignedInt
  service_id  Int    @default(0) @db.UnsignedInt
  ip_id       Int
  avis        String @db.VarChar(32)
}

model conso_radius {
  id       BigInt @id @default(autoincrement()) @db.UnsignedBigInt
  username String @db.VarChar(32)
  date     String @db.VarChar(32)
  download String @db.Text
  upload   String @db.Text
  nb_sess  Int    @default(0) @db.UnsignedInt

  @@index([date], map: "date")
  @@index([username], map: "username")
}

model conso_radius_daily {
  id            Int    @id @default(autoincrement()) @db.UnsignedInt
  username      String @db.VarChar(32)
  date          String @db.VarChar(32)
  download_nuit String @db.Text
  upload_nuit   String @db.Text
  download_jour String @db.Text
  upload_jour   String @db.Text

  @@index([date], map: "date")
  @@index([username], map: "username")
}

model conso_radius_daily2 {
  id            BigInt @id @default(autoincrement()) @db.UnsignedBigInt
  username      String @db.VarChar(32)
  date          String @db.VarChar(32)
  download_nuit String @default(dbgenerated("(0)")) @db.VarChar(64)
  upload_nuit   String @default(dbgenerated("(0)")) @db.VarChar(64)
  download_jour String @default(dbgenerated("(0)")) @db.VarChar(64)
  upload_jour   String @default(dbgenerated("(0)")) @db.VarChar(64)

  @@index([date], map: "date")
  @@index([username], map: "username")
}

model conso_radius_hourly {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  username String @db.VarChar(32)
  date     String @db.VarChar(32)
  download String @db.Text
  upload   String @db.Text

  @@index([date], map: "date")
  @@index([username], map: "username")
}

model conso_radius_monthly {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  date     String @db.VarChar(32)
  username String @db.VarChar(32)
  nuit     String @db.Text
  jour     String @db.Text

  @@index([date], map: "date")
  @@index([username], map: "username")
}

model conso_radius_monthly2 {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  date     String @db.VarChar(32)
  username String @db.VarChar(32)
  nuit     String @default(dbgenerated("(0)")) @db.VarChar(64)
  jour     String @default(dbgenerated("(0)")) @db.VarChar(64)

  @@index([date], map: "date")
  @@index([username], map: "username")
}


model delivery {
  id              BigInt  @id @default(autoincrement())
  account_id      BigInt?
  name            String  @db.VarChar(32)
  comment         String  @db.VarChar(512)
  date_orig       BigInt?
  address1        String? @db.VarChar(128)
  address2        String? @db.VarChar(128)
  city            String? @db.VarChar(32)
  state           String? @db.VarChar(32)
  zip             String? @db.VarChar(16)
  longitude       Decimal @db.Decimal(12, 7)
  latitude        Decimal @db.Decimal(12, 7)
  tel_home        String? @db.VarChar(16)
  tel_office      String? @db.VarChar(16)
  tel_office_ext  String? @db.VarChar(4)
  cell            String? @db.VarChar(12)
  fax             String? @db.VarChar(12)
  email           String? @db.VarChar(255)
  quota_max_day   BigInt  @default(0) @db.UnsignedBigInt
  quota_max_night BigInt  @default(0) @db.UnsignedBigInt
  contact         String? @db.VarChar(128)
  expanded        Int?    @default(0) @db.TinyInt
  placemarks_id   BigInt? @db.UnsignedBigInt
  epg_subid       Int     @default(0) @db.UnsignedInt

  @@index([account_id], map: "account_id")
  @@index([placemarks_id], map: "placemarks_id")
}

model delivery_history {
  id         Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id Int    @db.UnsignedInt
  date_orig  BigInt @db.UnsignedBigInt
  address1   String @db.VarChar(128)
  address2   String @db.VarChar(128)
  city       String @db.VarChar(128)
  state      String @db.VarChar(32)
  zip        String @db.VarChar(8)

  @@index([account_id], map: "account_id")
}

model device {
  id            Int     @id @default(autoincrement()) @db.UnsignedInt
  delivery_id   Int     @db.UnsignedInt
  category      String  @db.VarChar(64)
  name          String  @db.VarChar(128)
  manufacturier String? @db.VarChar(128)
  model         String? @db.VarChar(128)
  sn            String? @db.VarChar(128)
  mac           String? @db.VarChar(32)
  manage        String  @db.VarChar(256)
  port          String  @default(dbgenerated("()")) @db.VarChar(5)
  protocol      String  @default(dbgenerated("(https)")) @db.VarChar(8)
  manage_cli    String  @db.VarChar(256)
  port_cli      String  @default(dbgenerated("()")) @db.VarChar(5)
  protocol_cli  String  @db.VarChar(8)
  user          String  @db.VarChar(64)
  pass          String  @db.VarChar(128)
  parent        Int     @default(0) @db.UnsignedInt

  @@index([delivery_id], map: "delivery_id")
  @@index([sn], map: "sn")
}

model device_archive {
  id            Int     @id @default(autoincrement()) @db.UnsignedInt
  delivery_id   Int     @db.UnsignedInt
  category      String  @db.VarChar(64)
  name          String  @db.VarChar(128)
  manufacturier String? @db.VarChar(128)
  model         String? @db.VarChar(128)
  sn            String? @db.VarChar(128)
  mac           String? @db.VarChar(32)
  manage        String  @db.VarChar(256)
  port          String  @default(dbgenerated("()")) @db.VarChar(5)
  protocol      String  @default(dbgenerated("(https)")) @db.VarChar(8)
  manage_cli    String  @db.VarChar(256)
  port_cli      String  @default(dbgenerated("()")) @db.VarChar(5)
  protocol_cli  String  @db.VarChar(8)
  user          String  @db.VarChar(64)
  pass          String  @db.VarChar(128)
  parent        Int     @default(0) @db.UnsignedInt

  @@index([delivery_id], map: "delivery_id")
  @@index([sn], map: "sn")
}

model device_attr {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  device_id Int    @db.UnsignedInt
  attr      String @db.VarChar(128)
  value     String @db.VarChar(128)

  @@index([device_id], map: "device_id")
}

model device_link {
  id     Int @id @default(autoincrement()) @db.UnsignedInt
  parent Int @db.UnsignedInt
  child  Int @db.UnsignedInt
}

model device_template {
  id  Int    @id @default(autoincrement()) @db.UnsignedInt
  nom String @db.VarChar(128)
}

model device_template_attr {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  template_id Int    @db.UnsignedInt
  attr        String @db.VarChar(128)
  default_val String @db.VarChar(128)
}

model product {
  id                    Int     @id @default(autoincrement())
  date_orig             BigInt?
  sku                   String? @db.VarChar(32)
  active                Int?    @db.TinyInt
  price                 Float?
  price_recurr_type     Int?    @db.TinyInt
  price_recurr_weekday  Int?
  price_recurr_week     Int?
  price_recurr_schedule Int?    @db.TinyInt
  download_speed        BigInt?
  upload_speed          BigInt?
  night_package         Int     @default(0) @db.TinyInt
  quota_day             BigInt? @db.UnsignedBigInt
  quota_night           BigInt? @db.UnsignedBigInt
  category              Int?    @db.TinyInt
  uniq_charge           Int     @default(0) @db.TinyInt
  commercial            Boolean @default(false)
  portal_hidden         Boolean @default(false)
  inv_keep              Boolean @default(false)
  inv_tag               String? @db.VarChar(255)
  inv_threshold         Int     @default(0) @db.UnsignedInt
  inv_qte               Int     @default(0) @db.UnsignedInt
  emplacement           String  @default(dbgenerated("()")) @db.VarChar(16)
  list_tech             Int     @default(0) @db.UnsignedTinyInt
  type                  Int     @default(0) @db.UnsignedTinyInt
  combo_ready           Int     @default(0) @db.UnsignedTinyInt
  fibre_lineprofile     String? @db.VarChar(8)
  fibre_serviceprofile  String? @db.VarChar(8)

  @@index([sku], map: "sku")
}

model product_cat {
  id          Int     @id @default(autoincrement())
  name        String? @db.VarChar(255)
  notes       String? @db.VarChar(255)
  status      Int?    @db.TinyInt
  num_compte  BigInt?
  combo_dispo Int     @default(0) @db.UnsignedTinyInt
}

model product_format {
  id          BigInt  @id @default(autoincrement())
  date_orig   BigInt?
  name        String? @db.VarChar(255)
  type        Int?    @db.TinyInt
  product_idx String? @db.MediumText
  description String? @db.MediumText
}

model product_fournisseur {
  id              Int     @id @default(autoincrement()) @db.UnsignedInt
  product_id      Int     @db.UnsignedInt
  nom_fournisseur String  @db.VarChar(255)
  prix_us         Boolean @default(false)
  prix_achat      Float   @default(0.00)
  prix_livr       String  @default(dbgenerated("()")) @db.VarChar(16)
  delais_livr     String  @default(dbgenerated("()")) @db.VarChar(128)
  comment         String  @default(dbgenerated("()")) @db.VarChar(128)

  @@index([product_id], map: "product_id")
}

model product_profile {
  id              Int    @id @default(autoincrement()) @db.UnsignedInt
  product_id      Int    @db.UnsignedInt
  device_type     String @db.VarChar(64)
  line_profile    Int    @db.UnsignedInt
  service_profile Int    @db.UnsignedInt
}

model product_speciaux {
  id              BigInt  @id @default(autoincrement())
  product_zone_id BigInt
  product_id      BigInt
  price           Float?
  price_install   Float?
  exp_timestamp   BigInt?
  duree_contrat   Int?    @db.UnsignedTinyInt

  @@index([product_zone_id], map: "product_zone_id")
}

model product_translate {
  id                Int     @id @default(autoincrement())
  product_id        Int?
  language_id       String? @db.VarChar(16)
  name              String? @db.VarChar(512)
  description_short String? @db.LongText
  description_full  String? @db.LongText

  @@index([language_id], map: "language_id")
  @@index([product_id], map: "product_id")
}

model product_zone {
  id          BigInt  @id @default(autoincrement())
  zoneNumber  Int     @db.UnsignedInt
  description String? @db.VarChar(255)

  @@index([zoneNumber], map: "zoneNumber")
}

model product_zone_placemarks {
  id              BigInt @id @default(autoincrement())
  product_zone_id BigInt @db.UnsignedBigInt
  placemarks_id   BigInt @db.UnsignedBigInt

  @@index([placemarks_id], map: "placemarks_id")
}

model inventaire_log {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  prod_tag  String @db.VarChar(255)
  staff_id  Int    @db.UnsignedInt
  action    String @db.VarChar(1)
  qte       Int    @db.UnsignedInt
  timestamp String @db.VarChar(10)

  @@index([prod_tag], map: "prod_tag")
}

model phone {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  service_id  Int     @db.UnsignedInt
  phone_num   String  @db.VarChar(16)
  note        String? @db.Text
  fournisseur String? @db.VarChar(64)
}

model phone_addr {
  id               Int                         @id @default(autoincrement()) @db.UnsignedInt
  account_id       Int                         @db.UnsignedInt
  phone            String                      @db.VarChar(16)
  street_number    String                      @db.VarChar(10)
  apt              String                      @db.VarChar(30)
  street_name      String                      @db.VarChar(84)
  city             String                      @db.VarChar(38)
  state            String                      @db.VarChar(2)
  zip              String                      @db.VarChar(10)
  first_name       String                      @db.VarChar(38)
  last_name        String                      @db.VarChar(100)
  info             String                      @db.VarChar(100)
  enhanced_capable phone_addr_enhanced_capable @default(dbgenerated("(Y)"))
  code_cauca       String?                     @db.VarChar(3)
  class_service    String                      @default(dbgenerated("(RES)")) @db.VarChar(3)
}

model phone_comwave {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id  BigInt?
  service_id  BigInt?
  requestId   Int     @unique(map: "requestId") @db.UnsignedInt
  phoneNumber String  @db.VarChar(10)
  status      String  @default(dbgenerated("(P)")) @db.VarChar(1)
  date        String? @db.VarChar(10)
  reason      String? @db.Text
}

model phone_note {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  phone       String  @unique(map: "phone") @db.VarChar(11)
  rate_center String? @db.VarChar(128)
  fournisseur String  @default(dbgenerated("(comwave)")) @db.VarChar(64)
  note        String? @db.Text
}

model phone_provisioning {
  id             Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id     Int     @db.UnsignedInt
  delivery_id    Int     @db.UnsignedInt
  service_id     Int     @db.UnsignedInt
  phone          String  @db.VarChar(10)
  app            String  @db.VarChar(16)
  mac            String  @db.VarChar(16)
  password       String  @db.VarChar(32)
  internationnal String? @db.VarChar(6)
  date_orig      BigInt  @db.UnsignedBigInt
  date_update    BigInt  @db.UnsignedBigInt
}

model phonecall_channel {
  id                     Int    @id @default(autoincrement()) @db.UnsignedInt
  timestamp              BigInt @unique(map: "timestamp") @db.UnsignedBigInt
  max_tinktell           Int    @default(0) @db.UnsignedTinyInt
  max_outgoing_thinktell Int    @default(0) @db.UnsignedTinyInt
  max_comwave            Int    @default(0) @db.UnsignedTinyInt
  max_outgoing_comwave   Int    @default(0) @db.UnsignedTinyInt
  max_total              Int    @default(0) @db.UnsignedTinyInt
}

model phonecall_log_2025 {
  id                 Int      @id @default(autoincrement()) @db.UnsignedInt
  caller_id_name     String   @db.VarChar(64)
  caller_id_number   String   @db.VarChar(32)
  destination_number String   @db.VarChar(32)
  start_stamp        DateTime @db.DateTime(0)
  answer_stamp       DateTime @db.DateTime(0)
  end_stamp          DateTime @db.DateTime(0)
  duration           Int
  billing            Decimal  @default(0.00000) @db.Decimal(15, 5)
  hangup_cause       String   @db.VarChar(32)
  uuid               String   @unique(map: "uuid") @db.VarChar(64)
}

model phonecall_log_2026 {
  id                 Int      @id @default(autoincrement()) @db.UnsignedInt
  caller_id_name     String   @db.VarChar(64)
  caller_id_number   String   @db.VarChar(32)
  destination_number String   @db.VarChar(32)
  start_stamp        DateTime @db.DateTime(0)
  answer_stamp       DateTime @db.DateTime(0)
  end_stamp          DateTime @db.DateTime(0)
  duration           Int
  billing            Decimal  @default(0.00000) @db.Decimal(15, 5)
  hangup_cause       String   @db.VarChar(32)
  uuid               String   @unique(map: "uuid") @db.VarChar(64)
}

model voicemeup {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id  Int     @db.UnsignedInt
  date        BigInt  @db.UnsignedBigInt
  duration    Int     @db.UnsignedInt
  destination String  @db.VarChar(16)
  country     String  @db.VarChar(256)
  state       String? @db.VarChar(128)
  district    String? @db.VarChar(128)
  amount      Float
  uuid        String? @db.VarChar(64)
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
model babytel {
  date_time                        BigInt?
  record_type                      String? @db.VarChar(20)
  record_format_version            Int?
  id                               String? @db.VarChar(24)
  rate_id                          String? @db.VarChar(20)
  cost                             Float?  @db.Float
  calling_user                     String? @db.VarChar(24)
  called_user                      String? @db.VarChar(24)
  calling_domain                   String? @db.VarChar(24)
  called_domain                    String? @db.VarChar(24)
  destination                      String? @db.VarChar(24)
  duration_seconds                 String? @db.VarChar(24)
  call_start                       String? @db.VarChar(24)
  call_type                        String? @db.VarChar(24)
  call_direction                   String? @db.VarChar(24)
  test_call                        String? @db.VarChar(24)
  calling_number                   String? @db.VarChar(24)
  called_number_e164               String? @db.VarChar(24)
  billable_duration                String? @db.VarChar(24)
  billed_duration_outbound_seconds String? @db.VarChar(24)
  reseller_cost                    Float?  @db.Float
  master_account_id                String? @db.VarChar(24)
  forwarded_to                     String? @db.VarChar(24)
  master_account_pk                String? @db.VarChar(24)
  account_pk                       String? @db.VarChar(24)
  reseller_rate_id                 String? @db.VarChar(24)
  internal_information1            String? @db.VarChar(24)
  concurrents_calls                String? @db.VarChar(24)
  external_id                      String? @db.VarChar(24)
  commission                       Float?  @db.Float
  minute_plan_id                   String? @db.VarChar(24)
  internal_information2            String? @db.VarChar(24)
  internal_information3            String? @db.VarChar(24)
  billed_duration_inbound_seconds  String? @db.VarChar(24)
  selected_destination             String? @db.VarChar(24)
  internal_information4            String? @db.VarChar(24)
  internal_information5            String? @db.VarChar(24)
  cost_center                      String? @db.VarChar(24)
  subscriber_group                 String? @db.VarChar(24)

  @@ignore
}


/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model pbx {
  id                Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id        Int     @db.UnsignedInt
  delivery_id       Int     @db.UnsignedInt
  service_id        Int     @db.UnsignedInt
  phone             String  @db.VarChar(10)
  name              String? @db.VarChar(32)
  password          String  @db.VarChar(8)
  vm_password       String  @default(dbgenerated("(1234)")) @db.VarChar(16)
  has_vm            Int     @default(1) @db.TinyInt
  vm_email          String? @db.VarChar(64)
  keep_msg          Int     @default(0) @db.TinyInt
  vm_disk_quota     Int     @default(180) @db.UnsignedInt
  int_code          String  @db.VarChar(4)
  language          String  @default(dbgenerated("(fr)")) @db.VarChar(2)
  call_911          String  @db.VarChar(11)
  max_calls         Int     @default(2) @db.UnsignedTinyInt
  call_timeout      Int     @default(30) @db.UnsignedSmallInt
  user_context      String  @default(dbgenerated("(sip.targo.ca)")) @db.VarChar(32)
  country_whitelist String  @db.Text
  date_origin       BigInt  @db.UnsignedBigInt
  date_update       BigInt  @db.UnsignedBigInt
  update_by         Int?    @db.UnsignedInt

  @@index([phone], map: "phone")
}

model pbx_app {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  pbx_id      Int    @db.UnsignedInt
  username    String @db.VarChar(16)
  mac         String @db.VarChar(16)
  app         String @default(dbgenerated("(ht502)")) @db.VarChar(16)
  note        String @db.Text
  date_origin BigInt @db.UnsignedBigInt
  date_update BigInt @db.UnsignedBigInt
  update_by   Int?   @db.UnsignedInt

  @@index([pbx_id], map: "pbx_id")
}

model pbx_com {
  id                Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id        Int    @db.UnsignedInt
  delivery_id       Int    @db.UnsignedInt
  service_id        Int    @db.UnsignedInt
  phone             String @db.VarChar(10)
  name              String @db.VarChar(32)
  failover          String @db.VarChar(16)
  auth_method       String @default(dbgenerated("(password)")) @db.VarChar(8)
  password          String @db.VarChar(8)
  ip                String @db.VarChar(16)
  int_code          String @db.VarChar(4)
  country_whitelist String @db.Text
  language          String @db.VarChar(2)
  call_911          String @db.VarChar(16)
  max_calls         Int    @db.UnsignedTinyInt
  user_context      String @db.VarChar(32)
  date_origin       String @db.VarChar(16)
  date_update       String @db.VarChar(16)
  update_by         Int    @db.UnsignedInt
}

model pbx_com_wl {
  id                Int    @id @default(autoincrement())
  phone             String @unique(map: "phone") @db.VarChar(10)
  country_whitelist String @db.Text
}

model pbx_fax {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  number      String  @db.VarChar(10)
  email       String  @db.VarChar(128)
  description String? @db.VarChar(128)
  service_id  Int     @default(0) @db.UnsignedInt

  @@index([number], map: "number")
}

model payment {
  id          BigInt  @id @default(autoincrement())
  account_id  BigInt?
  date_orig   BigInt?
  amount      Float?
  applied_amt Float?
  type        String? @db.VarChar(25)
  memo        String? @db.VarChar(512)
  reference   String? @db.VarChar(128)
  excedent    Int     @default(0) @db.TinyInt
  correction  Int     @default(0) @db.TinyInt
  cr          Int     @default(0) @db.TinyInt
  uniqsess    String? @db.VarChar(32)

  @@index([account_id], map: "account_id")
  @@index([date_orig], map: "date_orig")
}

model payment_item {
  id         BigInt  @id @default(autoincrement())
  payment_id BigInt?
  invoice_id BigInt?
  amount     Float?
  date_orig  BigInt?

  @@index([invoice_id], map: "invoice_id")
  @@index([payment_id], map: "payment_id")
}

model passwords_manager {
  id            BigInt  @id @default(autoincrement())
  title         String  @db.VarChar(64)
  login         String  @db.VarChar(255)
  pass          String  @db.Text
  url           String? @db.VarChar(255)
  email         String? @db.VarChar(128)
  phone         String? @db.VarChar(32)
  category      String? @db.VarChar(32)
  subcategory   String? @db.VarChar(32)
  desc          String? @db.MediumText
  notes         String? @db.MediumText
  logs          String? @db.MediumText
  date_orig     BigInt
  date_last     BigInt
  users_granted String? @db.MediumText
  group_granted String? @db.Text
  created_by    BigInt
  keywords      String? @db.MediumText
}

model passwords_manager_cat {
  id    Int     @id @default(autoincrement()) @db.TinyInt
  title String  @db.VarChar(32)
  desc  String? @db.VarChar(255)
}

model passwords_manager_group {
  id    Int     @id @default(autoincrement()) @db.UnsignedInt
  name  String  @db.VarChar(32)
  users String? @db.Text
}

model notification {
  id              Int     @id @default(autoincrement()) @db.UnsignedInt
  staff_id        Int
  endpoint        String  @db.Text
  authToken       String  @db.Text
  publicKey       String  @db.Text
  contentEncoding String  @default(dbgenerated("(aesgcm)")) @db.VarChar(128)
  plateforme      String? @db.VarChar(128)

  @@index([staff_id], map: "staff_id")
}

model notification_payload {
  id              Int      @id @default(autoincrement()) @db.UnsignedInt
  notification_id Int      @db.UnsignedInt
  payload         String   @db.Text
  timestamp       DateTime @default(now()) @db.Timestamp(0)
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
model country {
  id          Int?    @unique(map: "IDS")
  name_en     String? @db.VarChar(128)
  name_fr     String? @db.VarChar(128)
  description String? @db.VarChar(128)
  notes       String? @db.VarChar(128)
  two_code    String? @db.VarChar(16)
  three_code  String? @db.VarChar(16)

  @@ignore
}

model municipalite {
  id             Int     @id @default(autoincrement()) @db.UnsignedInt
  nom            String  @db.VarChar(64)
  code           String  @db.VarChar(4)
  administration String  @db.VarChar(64)
  often_used     Boolean @default(false)
}


model sommaire_porte {
  id                 Int    @id @default(autoincrement()) @db.UnsignedInt
  fibre_id           Int    @default(0) @db.UnsignedInt
  id_adresse         String @db.VarChar(48)
  id_subvention      String @db.VarChar(32)
  adresse_subvention String @db.VarChar(128)
  ville_subvention   String @db.VarChar(128)
  latitude           String @db.VarChar(32)
  longitude          String @db.VarChar(32)
  contest_adresse    Int    @default(0) @db.UnsignedTinyInt
  new_adresse        Int    @default(0) @db.UnsignedTinyInt
  placemarks_id      BigInt @db.UnsignedBigInt
}

model state {
  id      Int    @id @default(autoincrement()) @db.UnsignedTinyInt
  name_en String @db.VarChar(64)
  name_fr String @db.VarChar(64)
  abbrev  String @db.VarChar(2)
  country String @db.VarChar(8)
}


model licence {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  nom        String  @db.VarChar(128)
  date       String  @db.VarChar(10)
  can_manage String  @db.VarChar(64)
  comment    String? @db.Text
}

model licence_key {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  licence_id  Int     @db.UnsignedInt
  licence_key String  @db.Text
  date        String  @db.VarChar(10)
  date_expire String? @db.VarChar(10)
  comment     String  @db.Text

  @@index([licence_id], map: "licence_id")
}

model ip {
  id                Int      @id @default(autoincrement())
  service_id        BigInt?
  ip                String?  @db.VarChar(32)
  prive             String?  @db.VarChar(32)
  ip_relais         String?  @db.VarChar(128)
  technology        String?  @db.VarChar(32)
  name_access_point String?  @db.VarChar(64)
  mac               String?  @db.VarChar(32)
  web_link          String?  @db.VarChar(128)
  link_relais       String?  @db.VarChar(128)
  ip_conso          Int      @default(0) @db.TinyInt
  actif             Int      @default(1) @db.TinyInt
  comment           String?  @db.MediumText
  cidr              String?  @db.VarChar(32)
  last_updated      DateTime @default(now()) @db.DateTime(0)

  @@index([ip], map: "ip")
  @@index([prive], map: "prive")
  @@index([service_id], map: "service_id")
}

model ip_admin {
  id      Int     @id @default(autoincrement()) @db.UnsignedInt
  ip      String  @db.VarChar(20)
  comment String? @db.VarChar(128)
}

model ip_history {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id  Int    @db.UnsignedInt
  delivery_id Int    @db.UnsignedInt
  service_id  Int    @db.UnsignedInt
  ip          String @db.VarChar(32)
  date        BigInt @db.UnsignedBigInt
}

model ip_pp {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  ip_prive  String @db.VarChar(32)
  ip_public String @db.VarChar(32)
  date      BigInt @db.UnsignedBigInt
  ip_id     String @default(dbgenerated("(0)")) @db.VarChar(64)
}

model ip_static {
  id      Int     @id @default(autoincrement()) @db.UnsignedInt
  ip      String  @unique(map: "ip") @db.VarChar(32)
  static  Boolean @default(false)
  reverse String? @db.VarChar(128)
}

model ip_targo {
  id      Int     @id @default(autoincrement()) @db.UnsignedInt
  ip      String  @db.VarChar(15)
  cidr    Int     @db.UnsignedTinyInt
  comment String? @db.VarChar(128)
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model invoice {
  id               BigInt  @id @default(autoincrement())
  date_orig        BigInt?
  process_status   Int?    @db.TinyInt
  billing_status   Int?    @db.TinyInt
  refund_status    Int?    @db.TinyInt
  print_status     Int?    @db.TinyInt
  account_id       BigInt?
  total_amt        Float?
  billed_amt       Float?
  due_date         BigInt?
  notes            String? @db.MediumText
  template_message String? @db.MediumText
  email_status     Int?    @db.TinyInt
  working_order    String? @db.VarChar(64)
  correction       Int     @default(0) @db.TinyInt
  ppa_charge       Int     @default(0) @db.TinyInt
  credit_code_id   Int     @default(0) @db.TinyInt

  @@index([account_id], map: "account_id")
  @@index([billing_status], map: "billing_status")
  @@index([date_orig], map: "date_orig")
  @@index([refund_status], map: "refund_status")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model invoice_bk {
  id               BigInt  @id @default(autoincrement())
  date_orig        BigInt?
  process_status   Int?    @db.TinyInt
  billing_status   Int?    @db.TinyInt
  refund_status    Int?    @db.TinyInt
  print_status     Int?    @db.TinyInt
  account_id       BigInt?
  total_amt        Float?
  billed_amt       Float?
  due_date         BigInt?
  notes            String? @db.MediumText
  template_message String? @db.MediumText
  email_status     Int?    @db.TinyInt
  working_order    String? @db.VarChar(64)
  correction       Int     @default(0) @db.TinyInt
  ppa_charge       Int     @default(0) @db.TinyInt
  credit_code_id   Int     @default(0) @db.TinyInt

  @@index([account_id], map: "account_id")
  @@index([billing_status], map: "billing_status")
  @@index([date_orig], map: "date_orig")
  @@index([refund_status], map: "refund_status")
}

model invoice_call {
  id     Int    @id @default(autoincrement()) @db.UnsignedInt
  date   BigInt @db.UnsignedBigInt
  number String @db.VarChar(10)
  amount Float
}

model invoice_item {
  id            BigInt  @id @default(autoincrement())
  service_id    BigInt?
  invoice_id    BigInt?
  sku           String? @db.VarChar(128)
  quantity      Float   @default(0)
  product_name  String? @db.VarChar(512)
  unitary_price Float?
  nosub         Boolean @default(false)
  delivery_name String? @db.VarChar(32)

  @@index([invoice_id], map: "invoice_id")
}

model invoice_item_bk {
  id            BigInt  @id @default(autoincrement())
  service_id    BigInt?
  invoice_id    BigInt?
  sku           String? @db.VarChar(128)
  quantity      Float   @default(0)
  product_name  String? @db.VarChar(512)
  unitary_price Float?
  nosub         Boolean @default(false)
  delivery_name String? @db.VarChar(32)

  @@index([invoice_id], map: "invoice_id")
}

model invoice_msg_template {
  id      BigInt  @id @default(autoincrement())
  name    String? @db.VarChar(32)
  message String? @db.MediumText
}

model invoice_tax {
  id              BigInt  @id @default(autoincrement())
  invoice_id      BigInt?
  tax_name        String? @db.VarChar(128)
  tax_description String? @db.VarChar(128)
  tax_rate        Float?
  amount          Float?

  @@index([invoice_id], map: "invoice_id")
}

model invoice_tax_bk {
  id              BigInt  @id @default(autoincrement())
  invoice_id      BigInt?
  tax_name        String? @db.VarChar(128)
  tax_description String? @db.VarChar(128)
  tax_rate        Float?
  amount          Float?

  @@index([invoice_id], map: "invoice_id")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model accord_paiement {
  id                Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id        Int     @db.UnsignedInt
  date_accord       BigInt
  date_echeance     BigInt
  date_coupure      BigInt  @db.UnsignedBigInt
  raison_changement String? @db.Text
  montant           Decimal @db.Decimal(10, 2)
  method            Int     @default(0) @db.UnsignedTinyInt
  ferie             Boolean @default(false)
  note              String? @db.Text
  status            Int     @default(-1) @db.TinyInt
  staff_id          Int     @default(1) @db.UnsignedInt
  date_create       String  @db.VarChar(16)

  @@index([account_id], map: "account_id")
}

model autologin {
  id    Int    @id @default(autoincrement()) @db.UnsignedInt
  token String @db.VarChar(32)
  date  String @db.VarChar(16)
  staff Int    @db.UnsignedInt
}

model statement {
  id        BigInt  @id @default(autoincrement())
  date      BigInt?
  type      String? @db.VarChar(2)
  number    BigInt?
  reference String? @db.MediumText
  amt       Float?
  paid_amt  Float?
}

model intranet_doc {
  id               BigInt   @id @default(autoincrement())
  account_id       BigInt
  date             BigInt
  title            String   @db.VarChar(128)
  msg              String   @db.MediumText
  attachment       String   @db.VarChar(256)
  unread_csv       String   @db.MediumText
  path_id          Int      @db.UnsignedInt
  priority_order   Int      @default(1)
  update_timestamp DateTime @default(now()) @db.Timestamp(0)

  @@index([account_id], map: "account_id")
  @@index([path_id], map: "path_id")
}

model intranet_doc_paths {
  id             Int    @id @default(autoincrement()) @db.UnsignedInt
  description    String @db.VarChar(256)
  parent_id      Int?   @db.UnsignedInt
  priority_order Int    @default(1)
}

model intranet_doc_reply {
  id               BigInt   @id @default(autoincrement())
  feed_id          BigInt
  date             BigInt
  account_id       BigInt
  msg              String   @db.MediumText
  attachment       BigInt   @default(0)
  update_timestamp DateTime @default(now()) @db.Timestamp(0)
}

model intranet_feed {
  id         BigInt @id @default(autoincrement())
  account_id BigInt
  date       BigInt
  title      String @db.VarChar(128)
  msg        String @db.MediumText
  attachment String @db.VarChar(256)
  unread_csv String @db.MediumText
}

model intranet_feed_reply {
  id         BigInt @id @default(autoincrement())
  feed_id    BigInt
  date       BigInt
  account_id BigInt
  msg        String @db.MediumText
  attachment BigInt
}

model intranet_techniciens {
  id         BigInt @id @default(autoincrement())
  account_id BigInt
  date       BigInt
  title      String @db.VarChar(128)
  msg        String @db.MediumText
  attachment String @db.VarChar(256)
  unread_csv String @db.MediumText
}

model intranet_techniciens_reply {
  id         BigInt @id @default(autoincrement())
  feed_id    BigInt
  date       BigInt
  account_id BigInt
  msg        String @db.MediumText
  attachment BigInt
}

model intranet_techno {
  id         BigInt @id @default(autoincrement())
  account_id BigInt
  date       BigInt
  title      String @db.VarChar(128)
  msg        String @db.MediumText
  attachment String @db.VarChar(256)
  unread_csv String @db.MediumText
}

model intranet_techno_reply {
  id         BigInt @id @default(autoincrement())
  feed_id    BigInt
  date       BigInt
  account_id BigInt
  msg        String @db.MediumText
  attachment BigInt
}

model fibre {
  id                   Int     @id @default(autoincrement()) @db.UnsignedInt
  terrain              String  @db.VarChar(16)
  rue                  String  @db.VarChar(128)
  ville                String  @db.VarChar(128)
  zip                  String  @default(dbgenerated("()")) @db.VarChar(7)
  ontid                Int?    @db.UnsignedInt
  sn                   String? @db.VarChar(32)
  tech                 Int     @default(2) @db.UnsignedSmallInt
  info_connect         String  @default(dbgenerated("(172.17.0.2)")) @db.VarChar(64)
  frame                Int?    @db.UnsignedTinyInt
  slot                 Int?    @db.UnsignedTinyInt
  port                 Int?    @db.UnsignedTinyInt
  vlan_manage          Int?    @db.UnsignedInt
  vlan_internet        Int?    @db.UnsignedInt
  vlan_telephone       Int?    @db.UnsignedInt
  vlan_tele            Int?    @db.UnsignedInt
  manage_service_id    Int?    @db.UnsignedInt
  internet_service_id  Int?    @db.UnsignedInt
  telephone_service_id Int?    @db.UnsignedInt
  tele_service_id      Int?    @db.UnsignedInt
  service_id           Int?    @db.UnsignedInt
  nb_drop              Int     @default(0) @db.UnsignedInt
  placemarks_id        BigInt? @db.UnsignedBigInt
  appartements_id      BigInt? @db.UnsignedBigInt
  latitude             Float?  @db.Float
  longitude            Float?  @db.Float
  boitier_pas_install  Int?    @db.UnsignedTinyInt
  description          String? @db.VarChar(50)
  suite                Int     @default(0) @db.UnsignedTinyInt
  distance             Int?    @db.UnsignedInt
  nb_portees           Int?    @db.UnsignedTinyInt

  @@index([appartements_id, sn], map: "appartements_id")
  @@index([info_connect, appartements_id, sn, slot, port], map: "info_connect")
  @@index([placemarks_id, sn], map: "placemarks_id")
  @@index([service_id], map: "service_id")
}

model fibre_olt {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  tech        Int    @db.UnsignedSmallInt
  ip          String @db.VarChar(64)
  description String @db.VarChar(128)
}

model fibre_service_port {
  id              Int @id @default(autoincrement()) @db.UnsignedInt
  last_service_id Int @db.UnsignedInt
}

model fibre_suivi {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  customer_id String? @db.VarChar(32)
  first_name  String  @db.VarChar(64)
  last_name   String  @db.VarChar(64)
  address     String  @db.VarChar(128)
  city        String  @db.VarChar(128)
  zip         String  @db.VarChar(7)
  phone       String  @db.VarChar(10)
  email       String? @db.VarChar(64)
  longitude   Decimal @db.Decimal(12, 7)
  latitude    Decimal @db.Decimal(12, 7)
  called      Int     @default(-1) @db.TinyInt
  create_by   Int     @default(0) @db.UnsignedInt
  note        String  @db.Text
}

model fibre_tech {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  description String @db.VarChar(128)
}

model fibre_videotron {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  date      String @db.VarChar(16)
  download  String @default(dbgenerated("(0)")) @db.VarChar(128)
  upload    String @default(dbgenerated("(0)")) @db.VarChar(128)
  ethernet  String @default(dbgenerated("()")) @db.VarChar(64)
  interface String @default(dbgenerated("()")) @db.VarChar(128)
}

model gantt {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id Int     @default(0) @db.UnsignedInt
  name       String? @db.VarChar(128)
  gantt      String  @db.Text
  closed     Int     @default(0) @db.TinyInt
}

model gantt_template {
  id    Int     @id @default(autoincrement()) @db.UnsignedInt
  name  String? @db.VarChar(128)
  gantt String  @db.Text
}

model project {
  id           Int     @id @default(autoincrement()) @db.UnsignedInt
  name         String  @db.VarChar(128)
  status       String  @db.VarChar(16)
  desc         String? @db.Text
  date_start   BigInt? @db.UnsignedBigInt
  date_end     BigInt? @db.UnsignedBigInt
  manager_name String? @db.VarChar(64)
}

model project_cmd {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  project_id Int     @db.UnsignedInt
  date       BigInt  @db.UnsignedBigInt
  vendeur    String? @db.VarChar(128)
  no_cmd     String? @db.VarChar(64)
  po         String? @db.VarChar(32)
  staff_id   Int     @default(4667) @db.UnsignedInt

  @@index([project_id], map: "project_id")
}

model project_cmd_item {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  cmd_id     Int     @db.UnsignedInt
  product_id Int     @default(0) @db.UnsignedInt
  desc       String  @db.Text
  qte        Float
  price      Float
  usd        Boolean @default(false)
  recu       Int     @default(0) @db.TinyInt
  qte_recu   Float   @default(0)
  date_recu  String? @db.VarChar(64)
  comment    String? @db.VarChar(128)
  eta        String? @db.VarChar(10)
  status     Int     @default(0) @db.UnsignedTinyInt

  @@index([cmd_id], map: "cmd_id")
  @@index([product_id], map: "product_id")
}

model project_manager_cat {
  id         Int    @id @default(autoincrement()) @db.UnsignedInt
  pos        Int    @db.UnsignedTinyInt
  name       String @db.VarChar(32)
  color      String @default(dbgenerated("(ffffff)")) @db.VarChar(7)
  text_color String @default(dbgenerated("(#000000)")) @db.VarChar(7)
}

model project_manager_checklist {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  task_id   Int    @db.UnsignedInt
  ticket_id Int    @db.UnsignedInt
  desc      String @db.VarChar(128)
  poids     Int    @default(1) @db.UnsignedTinyInt
  done      Int    @default(0) @db.TinyInt

  @@index([task_id], map: "task_id")
}

model project_manager_comment {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  task_id  Int    @db.UnsignedInt
  comment  String @db.Text
  staff_id Int    @db.UnsignedInt
  date     String @db.VarChar(16)
  unread   String @db.Text

  @@index([task_id], map: "task_id")
}

model project_manager_task {
  id             Int     @id @default(autoincrement()) @db.UnsignedInt
  category_id    Int     @db.UnsignedInt
  pos            Int     @db.UnsignedTinyInt
  titre          String  @db.VarChar(255)
  color          String  @default(dbgenerated("(#ffffff)")) @db.VarChar(7)
  text_color     String  @default(dbgenerated("(#000000)")) @db.VarChar(7)
  desc           String  @db.Text
  ticket_id      String? @db.VarChar(16)
  date_start     String? @db.VarChar(16)
  date_deadline  String? @db.VarChar(16)
  deadline_watch Int     @default(1) @db.UnsignedTinyInt
  assign_staff   String? @db.Text
  priority       Int     @default(0) @db.UnsignedTinyInt
  done           Boolean @default(false)
  create_by      Int     @db.UnsignedInt
  date_creation  String? @db.VarChar(16)
  date_update    String? @db.VarChar(16)

  @@index([category_id], map: "category_id")
}

model service {
  id                    BigInt  @id @default(autoincrement())
  date_orig             BigInt?
  date_suspended        BigInt?
  date_next_invoice     BigInt?
  date_last_invoice     BigInt?
  delivery_id           Int?
  device_id             Int     @default(0) @db.UnsignedInt
  product_id            Int?
  comment               String? @db.VarChar(255)
  payment_recurrence    Int?    @db.TinyInt
  status                Int?    @db.TinyInt
  hijack                Int     @default(0) @db.TinyInt
  hijack_price          Float   @default(0)
  hijack_desc           String? @db.VarChar(512)
  hijack_download_speed BigInt?
  hijack_upload_speed   BigInt?
  hijack_quota_day      BigInt?
  hijack_quota_night    BigInt?
  date_end_contract     BigInt?
  actif_until           BigInt?
  forfait_internet      Int     @default(0) @db.TinyInt
  radius_user           String  @db.VarChar(24)
  radius_pwd            String  @db.VarChar(16)
  radius_conso          Boolean @default(false)

  @@index([date_orig], map: "date_orig")
  @@index([delivery_id], map: "delivery_id")
  @@index([device_id], map: "device_id")
  @@index([id, status], map: "id")
  @@index([product_id], map: "product_id")
}

model service_snapshot {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  date        BigInt @db.UnsignedBigInt
  account_id  Int    @db.UnsignedInt
  service_id  Int    @db.UnsignedInt
  quota_day   BigInt @default(0) @db.UnsignedBigInt
  quota_night BigInt @default(0) @db.UnsignedBigInt

  @@index([account_id], map: "account_id")
  @@index([service_id], map: "service_id")
}

model soumission {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id BigInt
  name       String  @db.VarChar(64)
  po         String? @db.VarChar(64)
  date       String  @db.VarChar(10)
  tax        Int     @db.UnsignedTinyInt
  materiel   String? @db.LongText
  mensuel    String? @db.LongText
  text       String? @db.Text

  @@index([account_id], map: "account_id")
}

model soumission_template {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  name     String @db.VarChar(64)
  materiel String @db.LongText
  mensuel  String @db.LongText
}

model staff {
  id                   Int     @id @default(autoincrement()) @db.UnsignedInt
  status               Int     @db.TinyInt
  username             String  @unique(map: "username") @db.VarChar(32)
  password             String  @db.VarChar(128)
  vpn                  String  @db.VarChar(64)
  first_name           String  @db.VarChar(64)
  last_name            String  @db.VarChar(64)
  email                String  @db.VarChar(64)
  ext                  String  @db.VarChar(16)
  cell                 String  @db.VarChar(16)
  gpin                 String? @db.VarChar(4)
  rights               String  @db.Text
  date_embauche        String? @db.VarChar(20)
  fete                 String? @db.VarChar(16)
  supp                 String? @db.Text
  group_ad             String  @default(dbgenerated("()")) @db.VarChar(64)
  dept_list            String  @db.Text
  notification         String  @db.Text
  darkmode             Boolean @default(false)
  matricule_desjardins Int?    @db.UnsignedInt
  compagnie_desjardins String? @db.VarChar(8)
  ldap_id              Int?
}

model staff_dispo {
  id       Int  @id @default(autoincrement()) @db.TinyInt
  day_num  Int  @db.TinyInt
  staff_id Int?
}

model staff_supp {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  nom       String @db.VarChar(64)
  staff_ids String @db.VarChar(128)
}

model tele_carte {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  delivery_id Int    @unique(map: "delivery_id") @default(0) @db.UnsignedInt
  service_id  Int    @db.UnsignedInt
  channels    String @db.Text
}

model tele_channel {
  id                   Int     @id @default(autoincrement()) @db.UnsignedInt
  proprio              String  @db.VarChar(128)
  poste                String  @db.VarChar(128)
  pack_min             Int     @default(0) @db.UnsignedTinyInt
  pack_redevance       Decimal @default(0.00) @db.Decimal(5, 2)
  pack_prix_vendu      Decimal @default(0.00) @db.Decimal(5, 2)
  carte_percentage     Decimal @db.Decimal(5, 2)
  carte_redevance_min  Decimal @db.Decimal(5, 2)
  carte_prix_vendu     Decimal @db.Decimal(5, 2)
  monthly_min          Decimal @default(0.00) @db.Decimal(5, 2)
  has_penetration_rate Int     @default(0) @db.UnsignedTinyInt
  penetration_actuel   Decimal @default(0.00) @db.Decimal(3, 2)
  is_commercial        Int     @default(0) @db.UnsignedTinyInt
  note                 String  @db.Text
  epgId                Int     @default(0) @db.UnsignedInt
  uptele_no            Int     @db.UnsignedInt
  uptele_code          String  @db.VarChar(32)
  abbr                 String  @db.VarChar(32)
  groupe_id            Int     @default(0) @db.UnsignedInt
  ccsa_packageID       Int     @db.UnsignedInt
  ccsa_desc            String  @db.VarChar(256)
  rapport_bell         Int     @default(0) @db.TinyInt
}

model tele_groupe {
  id         Int    @id @default(autoincrement()) @db.UnsignedInt
  nom        String @db.VarChar(128)
  small_desc String @db.VarChar(128)
}

model tele_network {
  id           Int    @id @default(autoincrement()) @db.UnsignedInt
  network_name String @db.VarChar(128)
  fournisseur  String @db.VarChar(128)
}

model tele_pack {
  id             Int     @id @default(autoincrement())
  product_id     Int     @db.UnsignedInt
  channels       String  @db.Text
  actif          Boolean @default(true)
  ccsa_packageID Int     @db.UnsignedInt
  ccsa_desc      String  @db.VarChar(256)
  rapport_bell   Int     @default(0) @db.TinyInt
  bell_name      String? @db.VarChar(64)
  epgId          Int?    @db.UnsignedInt
}

model tele_penetration {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  id_channel Int     @db.UnsignedInt
  percentage Decimal @db.Decimal(3, 2)
  prix       Decimal @db.Decimal(10, 5)
}

model tele_sub_archive {
  id           Int    @id @default(autoincrement())
  date_archive String @db.VarChar(16)
  subs         String @db.Text
}

model tele_wiz {
  id          Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id  Int    @db.UnsignedInt
  delivery_id Int    @db.UnsignedInt
  ticket_id   Int    @db.UnsignedInt
  nb_stb      Int    @db.UnsignedTinyInt
  credit      Int    @db.UnsignedTinyInt
  fbase       Int    @db.UnsignedInt
  fthem       String @db.Text
}

model tv_mac {
  id         Int    @id @default(autoincrement()) @db.UnsignedInt
  service_id Int    @db.UnsignedInt
  mac        String @db.VarChar(12)
}

model ticket {
  id               BigInt   @id @default(autoincrement()) @db.UnsignedBigInt
  ost_id           Int?     @db.UnsignedInt
  parent           BigInt   @default(0)
  account_id       BigInt?
  delivery_id      BigInt   @default(0)
  bon_id           Int?     @db.UnsignedInt
  subject          String?  @db.VarChar(256)
  dept_id          Int?
  open_by          Int      @default(1)
  email_from       String   @db.VarChar(128)
  assign_to        Int      @default(0)
  status           String   @default(dbgenerated("(open)")) @db.VarChar(32)
  due_date         BigInt   @default(0)
  due_time         String   @default(dbgenerated("(day)")) @db.VarChar(8)
  date_create      BigInt?
  last_update      BigInt?
  date_closed      String   @default(dbgenerated("()")) @db.VarChar(16)
  pending_to_open  BigInt   @default(0) @db.UnsignedBigInt
  waiting_for      BigInt?  @db.UnsignedBigInt
  lock_name        String   @db.VarChar(64)
  public           Boolean? @default(false)
  priority         Int      @default(2) @db.TinyInt
  install_success  Int      @default(0) @db.TinyInt
  wizard           String?  @db.Text
  wizard_fibre     String?  @db.VarChar(64)
  important        Int      @default(0) @db.TinyInt
  followed_by      String   @db.Text
  participant      String   @db.Text
  update_timestamp DateTime @default(now()) @db.Timestamp(0)
  closed_by        Int      @default(0) @db.UnsignedInt

  @@index([account_id], map: "account_id")
  @@index([assign_to], map: "assign_to")
  @@index([dept_id], map: "dept_id")
}

model ticket_calendar_lock {
  id          Int      @id @default(autoincrement()) @db.UnsignedInt
  date_lock   BigInt   @default(0) @db.UnsignedBigInt
  dept_id     Int      @default(12) @db.UnsignedInt
  nb_install  Int      @default(0) @db.UnsignedSmallInt
  create_by   Int      @db.UnsignedInt
  update_by   Int      @db.UnsignedInt
  last_update DateTime @default(now()) @db.Timestamp(0)

  @@unique([date_lock, dept_id], map: "date_dept")
}

model ticket_calendar_staff_lock {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  date     BigInt
  staff_id Int    @db.UnsignedInt
}

model ticket_conge {
  id         Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id Int    @db.UnsignedInt
  name       String @db.VarChar(128)
  date       BigInt @db.UnsignedBigInt
  desc       String @db.VarChar(255)
  ticket_id  Int?   @db.UnsignedInt

  @@index([account_id], map: "account_id")
}

model ticket_dept {
  id             Int     @id @default(autoincrement()) @db.UnsignedInt
  parent         Int     @default(0)
  name           String  @unique(map: "name") @default(dbgenerated("()")) @db.VarChar(32)
  hasChild       Int     @default(0) @db.SmallInt
  email          String  @db.VarChar(64)
  manager_id     Int     @default(0) @db.UnsignedInt
  member_only    Boolean @default(false)
  protected      Boolean @default(false)
  default_staff  Int     @default(0) @db.UnsignedInt
  default_follow String  @default(dbgenerated("(0)")) @db.VarChar(64)
}

model ticket_msg {
  id               BigInt   @id @default(autoincrement()) @db.UnsignedBigInt
  ticket_id        BigInt
  staff_id         BigInt   @default(0)
  msg              String?  @db.MediumText
  date_orig        BigInt?
  unread_csv       String   @db.MediumText
  public           Boolean? @default(false)
  important        Int      @default(0) @db.TinyInt
  update_timestamp DateTime @default(now()) @db.Timestamp(0)

  @@index([staff_id], map: "staff_id")
  @@index([ticket_id], map: "ticket_id")
}

model ticket_template {
  id       Int    @id @default(autoincrement()) @db.UnsignedInt
  name     String @db.VarChar(128)
  template String @db.Text
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
model tmp {
  id     Int    @db.UnsignedInt
  prive  String @db.VarChar(20)
  public String @db.VarChar(20)

  @@ignore
}

model tmp_vpn {
  id       Int     @id
  username String  @db.VarChar(64)
  password String  @db.VarChar(64)
  ad_done  Boolean @default(false)
  tacacs   Boolean @default(false)
  m        Int     @default(2000) @db.UnsignedInt
}

model bon_travail {
  id              Int      @id @default(autoincrement()) @db.UnsignedInt
  date            BigInt?  @db.UnsignedBigInt
  account_id      Int      @db.UnsignedInt
  tech1           Int?     @db.UnsignedInt
  heure_arrive_t1 String?  @db.VarChar(10)
  heure_depart_t1 String?  @db.VarChar(10)
  tech2           Int?     @db.UnsignedInt
  heure_arrive_t2 String?  @db.VarChar(10)
  heure_depart_t2 String?  @db.VarChar(10)
  note            String?  @db.Text
  subtotal        Decimal? @db.Decimal(10, 2)
  tps             Decimal? @db.Decimal(10, 2)
  tvq             Decimal? @db.Decimal(10, 2)
  total           Decimal? @db.Decimal(10, 2)
}

model bon_travail_item {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  bon_id     Int     @db.UnsignedInt
  product_id Int     @db.UnsignedInt
  qte        Int
  price      Decimal @db.Decimal(10, 2)
  desc       String  @db.Text
}

model checklist_relais {
  id                 Int     @id @default(autoincrement()) @db.UnsignedInt
  site_id            Int     @unique(map: "site_id") @db.UnsignedInt
  site_name          String? @db.VarChar(128)
  account_id         Int     @db.UnsignedInt
  priority           Int     @default(2) @db.UnsignedTinyInt
  done               Int     @default(0) @db.UnsignedTinyInt
  equipement         String? @db.Text
  connecteur         String? @db.Text
  grounding          String? @db.Text
  surge_lightning    String? @db.Text
  switch_poe         String? @db.Text
  switch_giga_shield String? @db.Text
  batterie           String? @db.Text
  solidity           String? @db.Text
  redondance         String? @db.Text
  antenne_58_360     String? @db.Text
  antenne_24_360     String? @db.Text
  rspro_maj          String? @db.Text
  boite              String? @db.Text
  cable              String? @db.Text
  staros_ubnt        String? @db.Text
  autre              String? @db.Text
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model conference {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  room_id     Int     @db.UnsignedInt
  time_start  String  @db.VarChar(16)
  time_end    String  @db.VarChar(16)
  name        String  @db.VarChar(128)
  description String? @db.Text
  host        Int     @db.UnsignedInt
  participant String  @db.Text
}

model conference_room {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  name        String  @db.VarChar(128)
  status      Int     @default(1) @db.TinyInt
  location    String? @db.VarChar(128)
  description String? @db.Text
}

model fournisseur {
  id    Int     @id @default(autoincrement()) @db.UnsignedInt
  nom   String  @db.VarChar(128)
  email String  @db.VarChar(64)
  actif Boolean @default(true)
}

model notice_gui {
  id        Int    @id @default(autoincrement()) @db.UnsignedInt
  staff_id  Int    @db.UnsignedInt
  message   String @db.Text
  is_read   Int    @default(0)
  timestamp String @db.VarChar(10)
}

model promo {
  id            Int     @id @default(autoincrement()) @db.UnsignedInt
  name          String? @db.VarChar(64)
  desc          String? @db.Text
  date_start    BigInt? @db.UnsignedBigInt
  date_end      BigInt? @db.UnsignedBigInt
  date_orig     BigInt?
  visible_until BigInt?
  actif         Int     @default(0) @db.TinyInt
}

model stbs {
  id    Int     @id @default(autoincrement()) @db.UnsignedInt
  mac   String  @unique(map: "mac") @db.VarChar(32)
  sn    String  @db.VarChar(32)
  targo String? @db.VarChar(16)
}

model tech_dispo {
  id   Int    @id @default(autoincrement()) @db.UnsignedInt
  date BigInt @unique(map: "date") @db.UnsignedBigInt
  tech Int?   @db.UnsignedInt
}

enum phone_addr_enhanced_capable {
  Y
  N
}

/// ************** DEPRECATED ********************************************
model debug {
  id         BigInt  @id @default(autoincrement())
  autor      String? @db.VarChar(32)
  url        String? @db.VarChar(128)
  date_last  BigInt?
  desc       String? @db.MediumText
  note4autor String? @db.MediumText
  note4dev   String? @db.MediumText
  status     String? @db.VarChar(64)
}

model carte_temps {
  id          Int     @id @default(autoincrement()) @db.UnsignedInt
  week        Int     @db.UnsignedTinyInt
  year        Int?    @db.UnsignedInt
  date        BigInt  @db.UnsignedBigInt
  staff_id    BigInt  @db.UnsignedBigInt
  start_am    BigInt? @db.UnsignedBigInt
  end_am      BigInt? @db.UnsignedBigInt
  start_pm    BigInt? @db.UnsignedBigInt
  end_pm      BigInt? @db.UnsignedBigInt
  start_night BigInt? @db.UnsignedBigInt
  end_night   BigInt? @db.UnsignedBigInt
  relais      Float?
  comment     String? @db.Text
  note_int    String? @db.Text
  conge       Int     @default(0) @db.UnsignedTinyInt
  appr        String? @db.VarChar(8)
  appr_dir    String? @db.VarChar(8)

  @@index([staff_id], map: "staff_id")
}

model carte_temps_periode {
  id      Int    @id @default(autoincrement()) @db.UnsignedSmallInt
  debut   String @db.VarChar(16)
  fin     String @db.VarChar(16)
  paid    String @db.VarChar(16)
  periode Int    @db.UnsignedTinyInt
  annee   Int    @db.UnsignedSmallInt
}

model banque_heure_staff {
  id       Int     @id @default(autoincrement()) @db.UnsignedInt
  staff_id Int     @db.UnsignedInt
  week     Int     @db.UnsignedTinyInt
  year     Int     @db.UnsignedSmallInt
  sunday   String? @db.VarChar(16)
  heure    Float

  @@index([staff_id], map: "staff_id")
}

model hour_bank {
  id              Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id      BigInt  @db.UnsignedBigInt
  remaining_time  Int     @default(0)
  expiration_date BigInt  @default(0) @db.UnsignedBigInt
  note            String? @db.MediumText
  recurrence      Int     @default(0) @db.UnsignedTinyInt
  reset_value     Int     @default(0) @db.UnsignedSmallInt

  @@index([account_id], map: "account_id")
}

model hour_bank_detail {
  id            Int     @id @default(autoincrement())
  hour_id       Int
  staff_id      BigInt? @db.UnsignedBigInt
  date_orig     BigInt  @db.UnsignedBigInt
  used_time     Int     @default(0) @db.SmallInt
  ticket_id     BigInt? @db.UnsignedBigInt
  working_order String? @db.VarChar(16)
  detail        String? @db.MediumText

  @@index([hour_id], map: "hour_id")
}


model test {
  id   Int    @id @default(autoincrement()) @db.UnsignedInt
  text String @db.Text
  c2   Int    @default(1)
}

//this table is for CSS class only, no other uses
model account_memo_template {
  id     Int    @id @default(autoincrement())
  name   String @db.VarChar(32)
  color  String @db.VarChar(6)
  bcolor String @db.VarChar(6)
  border String @default(dbgenerated("(000000)")) @db.VarChar(6)
}

//not used
model notes {
  id         Int    @id @default(autoincrement())
  account_id Int    @db.UnsignedInt
  notes      String @db.MediumText
}

//NOT USED
model email {
  id         Int     @id @default(autoincrement())
  account_id BigInt?
  email      String? @db.VarChar(128)
  password   String? @db.VarChar(128)
}

//not relevant to ticket module
model client_pwd {
  id         Int     @id @default(autoincrement()) @db.UnsignedInt
  account_id Int     @db.UnsignedInt
  date       BigInt  @db.UnsignedBigInt
  uid        String  @db.VarChar(32)
  used       Boolean @default(false)
}


//NO USES FOR TICKETING PURPOSES
model account_profile {
  id                  Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id          Int    @db.UnsignedInt
  profile_id          String @db.VarChar(64)
  address_id          String @db.VarChar(64)
  card_id             String @db.VarChar(64)
  token               String @db.VarChar(32)
  initial_transaction String @db.VarChar(128)
}


//not relevant to ticket module
model deposit_slip {
  id          Int     @id @default(autoincrement())
  customer_id String? @db.VarChar(32)
  name        String? @db.VarChar(512)
  amount      Float   @default(0)
  type        String  @db.VarChar(32)
  desc        String? @db.VarChar(255)
  date        BigInt? @db.UnsignedBigInt
}

//this table display suspended account
model account_suspension {
  id         Int    @id @default(autoincrement()) @db.UnsignedInt
  account_id Int    @unique(map: "account_id") @db.UnsignedInt
  date_start BigInt @db.UnsignedBigInt
  date_end   BigInt @db.UnsignedBigInt
  note       String @db.VarChar(128)
}