generator client {
  provider = "prisma-client-js"
}

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

model MS_SUITABLE {
  id                                        Int      @id @default(autoincrement())
  product_name                              String   @db.VarChar(200)
  manufacturer                              String?  @db.VarChar(200)
  roof_material                             String?  @db.VarChar(100)
  shape                                     String?  @db.VarChar(200)
  support_roof_tile                         String?  @db.VarChar(2)
  support_roof_tile_memo                    String?  @db.VarChar(500)
  support_roof_bracket                      String?  @db.VarChar(200)
  support_roof_bracket_memo                 String?  @db.VarChar(500)
  yg_anchor                                 String?  @db.VarChar(200)
  yg_anchor_memo                            String?  @db.VarChar(500)
  rg_roof_tile_part                         String?  @db.VarChar(200)
  rg_roof_tile_part_memo                    String?  @db.VarChar(500)
  dido_hunt_support_tile_2                  String?  @db.VarChar(200)
  dido_hunt_support_tile_2_memo             String?  @db.VarChar(500)
  takashima_power_base                      String?  @db.VarChar(200)
  takashima_power_base_memo                 String?  @db.VarChar(500)
  takashima_tile_bracket                    String?  @db.VarChar(200)
  takashima_tile_bracket_memo               String?  @db.VarChar(500)
  slate_bracket_4                           String?  @db.VarChar(200)
  slate_bracket_4_memo                      String?  @db.VarChar(500)
  slate_single_metal_bracket                String?  @db.VarChar(200)
  slate_single_metal_bracket_memo           String?  @db.VarChar(500)
  dido_hunt_short_rack_4                    String?  @db.VarChar(200)
  dido_hunt_short_rack_4_memo               String?  @db.VarChar(500)
  takashima_slate_bracket_slate_single      String?  @db.VarChar(200)
  takashima_slate_bracket_slate_single_memo String?  @db.VarChar(500)
  df_metal_bracket                          String?  @db.VarChar(200)
  df_metal_bracket_memo                     String?  @db.VarChar(500)
  slate_metal_bracket                       String?  @db.VarChar(200)
  slate_metal_bracket_memo                  String?  @db.VarChar(500)
  takashima_slate_bracket_metal_roof        String?  @db.VarChar(200)
  takashima_slate_bracket_metal_roof_memo   String?  @db.VarChar(500)
  created_at                                DateTime @default(now())
  updated_at                                DateTime @updatedAt
}

model SD_SURVEY_SALES_BASIC_INFO {
  ID                   Int                          @id @default(autoincrement())
  SRL_NO               String                       @db.VarChar(20)
  REPRESENTATIVE       String                       @db.VarChar(200)
  STORE                String?                      @db.VarChar(200)
  CONSTRUCTION_POINT   String?                      @db.VarChar(200)
  INVESTIGATION_DATE   String?                      @db.VarChar(10)
  BUILDING_NAME        String?                      @db.VarChar(200)
  CUSTOMER_NAME        String?                      @db.VarChar(200)
  POST_CODE            String?                      @db.VarChar(10)
  ADDRESS              String?                      @db.VarChar(200)
  ADDRESS_DETAIL       String?                      @db.VarChar(300)
  SUBMISSION_STATUS    Boolean                      @default(false)
  SUBMISSION_DATE      DateTime?                    @db.Date
  SUBMISSION_TARGET_ID String?                      @db.VarChar(200)
  REG_DT               DateTime                     @default(now())
  UPT_DT               DateTime                     @updatedAt
  DETAIL_INFO          SD_SURVEY_SALES_DETAIL_INFO?
}

model SD_SURVEY_SALES_DETAIL_INFO {
  ID                            Int                        @id @default(autoincrement())
  CONTRACT_CAPACITY             String?                    @db.VarChar(20)
  RETAIL_COMPANY                String?                    @db.VarChar(100)
  SUPPLEMENTARY_FACILITIES      String?                    @db.VarChar(20)
  SUPPLEMENTARY_FACILITIES_ETC  String?                    @db.VarChar(200)
  INSTALLATION_SYSTEM           String?                    @db.VarChar(20)
  INSTALLATION_SYSTEM_ETC       String?                    @db.VarChar(200)
  CONSTRUCTION_YEAR             String?                    @db.VarChar(200)
  CONSTRUCTION_YEAR_ETC         String?                    @db.VarChar(200)
  ROOF_MATERIAL                 String?                    @db.VarChar(20)
  ROOF_MATERIAL_ETC             String?                    @db.VarChar(200)
  ROOF_SHAPE                    String?                    @db.VarChar(20)
  ROOF_SHAPE_ETC                String?                    @db.VarChar(200)
  ROOF_SLOPE                    String?                    @db.VarChar(5)
  HOUSE_STRUCTURE               String?                    @db.VarChar(20)
  HOUSE_STRUCTURE_ETC           String?                    @db.VarChar(200)
  RAFTER_MATERIAL               String?                    @db.VarChar(20)
  RAFTER_MATERIAL_ETC           String?                    @db.VarChar(200)
  RAFTER_SIZE                   String?                    @db.VarChar(20)
  RAFTER_SIZE_ETC               String?                    @db.VarChar(200)
  RAFTER_PITCH                  String?                    @db.VarChar(20)
  RAFTER_PITCH_ETC              String?                    @db.VarChar(200)
  RAFTER_DIRECTION              String?                    @db.VarChar(20)
  OPEN_FIELD_PLATE_KIND         String?                    @db.VarChar(20)
  OPEN_FIELD_PLATE_KIND_ETC     String?                    @db.VarChar(200)
  OPEN_FIELD_PLATE_THICKNESS    String?                    @db.VarChar(5)
  LEAK_TRACE                    Boolean?                   @default(false)
  WATERPROOF_MATERIAL           String?                    @db.VarChar(20)
  WATERPROOF_MATERIAL_ETC       String?                    @db.VarChar(200)
  INSULATION_PRESENCE           String?                    @db.VarChar(20)
  INSULATION_PRESENCE_ETC       String?                    @db.VarChar(200)
  STRUCTURE_ORDER               String?                    @db.VarChar(20)
  STRUCTURE_ORDER_ETC           String?                    @db.VarChar(200)
  INSTALLATION_AVAILABILITY     String?                    @db.VarChar(20)
  INSTALLATION_AVAILABILITY_ETC String?                    @db.VarChar(200)
  MEMO                          String?                    @db.VarChar(500)
  REG_DT                        DateTime                   @default(now())
  UPT_DT                        DateTime                   @updatedAt
  BASIC_INFO_ID                 Int                        @unique
  BASIC_INFO                    SD_SURVEY_SALES_BASIC_INFO @relation(fields: [BASIC_INFO_ID], references: [ID])
}

model BC_COMM_H {
  HEAD_CD    String      @id(map: "PK_BC_COMM_H") @db.NVarChar(6)
  HEAD_ID    String?     @db.NVarChar(100)
  HEAD_NM    String?     @db.NVarChar(100)
  HEAD_JP    String?     @db.NVarChar(100)
  HEAD_4TH   String?     @db.NVarChar(100)
  REF_CHR1   String?     @db.NVarChar(100)
  REF_CHR2   String?     @db.NVarChar(100)
  REF_CHR3   String?     @db.NVarChar(100)
  REF_CHR4   String?     @db.NVarChar(100)
  REF_CHR5   String?     @db.NVarChar(100)
  REF_NUM1   String?     @db.NVarChar(100)
  REF_NUM2   String?     @db.NVarChar(100)
  REF_NUM3   String?     @db.NVarChar(100)
  REF_NUM4   String?     @db.NVarChar(100)
  REF_NUM5   String?     @db.NVarChar(100)
  REMARKS    String?     @db.NVarChar(200)
  SAP_YN     String?     @db.NVarChar(1)
  STAT_CD    String?     @db.NVarChar(1)
  DEL_YN     String?     @db.NVarChar(1)
  REG_DT     DateTime?   @db.DateTime
  REG_ID     String?     @db.NVarChar(50)
  UPT_DT     DateTime?   @db.DateTime
  UPT_ID     String?     @db.NVarChar(50)
  QC_COMM_YN String?     @default("N", map: "DF__BC_COMM_H__QC_CO__48CFD27E") @db.NVarChar(1)
  BC_COMM_L  BC_COMM_L[]

  @@index([HEAD_ID], map: "BC_COMM_H_HEAD_ID_IDX")
}

model BC_COMM_L {
  HEAD_CD   String    @db.NVarChar(6)
  CODE      String    @db.NVarChar(50)
  READ_CD   String?   @db.NVarChar(50)
  CODE_NM   String?   @db.NVarChar(100)
  CODE_JP   String?   @db.NVarChar(100)
  CODE_4TH  String?   @db.NVarChar(100)
  REF_CHR1  String?   @db.NVarChar(150)
  REF_CHR2  String?   @db.NVarChar(150)
  REF_CHR3  String?   @db.NVarChar(150)
  REF_CHR4  String?   @db.NVarChar(150)
  REF_CHR5  String?   @db.NVarChar(150)
  REF_NUM1  Decimal?  @db.Decimal(22, 5)
  REF_NUM2  Decimal?  @db.Decimal(22, 5)
  REF_NUM3  Decimal?  @db.Decimal(22, 5)
  REF_NUM4  Decimal?  @db.Decimal(22, 5)
  REF_NUM5  Decimal?  @db.Decimal(22, 5)
  PRIORITY  Decimal?  @db.Decimal(3, 0)
  REF_CNT   String?   @db.NVarChar(5)
  STAT_CD   String?   @db.NVarChar(1)
  DEL_YN    String?   @db.NVarChar(1)
  REG_DT    DateTime? @db.DateTime
  REG_ID    String?   @db.NVarChar(50)
  UPT_DT    DateTime? @db.DateTime
  UPT_ID    String?   @db.NVarChar(50)
  BC_COMM_H BC_COMM_H @relation(fields: [HEAD_CD], references: [HEAD_CD], onUpdate: NoAction, map: "FK_BC_COMM_L")

  @@id([HEAD_CD, CODE], map: "PK_BC_COMM_L")
}

model MS_SUITABLE_ROOF_MATERIAL_GROUP {
  ID                  Int       @id @default(autoincrement())
  ROOF_MATERIAL_GROUP String    @db.VarChar(200)
  ROOF_MT_CD          String    @db.VarChar(200)
  REG_DT              DateTime  @default(now(), map: "DF__MS_SUITAB__creat__4F7CD00D")
  UPT_DT              DateTime?
}

model MS_SUITABLE_DETAIL {
  ID                                Int              @id @default(autoincrement())
  MAIN_ID                           Int
  TRESTLE_MFPC_CD                   String?          @db.VarChar(200)
  TRESTLE_MANUFACTURER_PRODUCT_NAME String?          @db.VarChar(200)
  MEMO                              String?          @db.VarChar(500)
  REG_DT                            DateTime         @default(now(), map: "DF__MS_SUITAB__creat__571DF1D5")
  UPT_DT                            DateTime?
  MS_SUITABLE_MAIN                  MS_SUITABLE_MAIN @relation(fields: [MAIN_ID], references: [ID], onUpdate: NoAction, map: "MS_SUITABLE_DETAIL_MS_SUITABLE_MAIN_FK")

  @@index([MAIN_ID, TRESTLE_MANUFACTURER_PRODUCT_NAME], map: "MS_SUITABLE_DETAIL_MAIN_ID_IDX")
}

model MS_SUITABLE_MAIN {
  ID                 Int                  @id @default(autoincrement())
  PRODUCT_NAME       String               @db.VarChar(200)
  MANU_FT_CD         String?              @db.VarChar(200)
  ROOF_MT_CD         String?              @db.VarChar(100)
  ROOF_SH_CD         String?              @db.VarChar(200)
  REG_DT             DateTime             @default(now(), map: "DF__MS_SUITAB__creat__5441852A")
  UPT_DT             DateTime?
  MS_SUITABLE_DETAIL MS_SUITABLE_DETAIL[]

  @@index([PRODUCT_NAME], map: "MS_SUITABLE_MAIN_PRODUCT_NAME_IDX")
  @@index([ROOF_MT_CD, PRODUCT_NAME], map: "MS_SUITABLE_MAIN_ROOF_MT_CD_IDX")
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
model MS_USR_TRK {
  ID     Int      @id @default(autoincrement())
  OWNER  String   @db.VarChar(100)
  TYPE   String   @db.VarChar(50)
  URL    String?  @db.VarChar(200)
  REG_DT DateTime @default(now())
  DATA   String?  @db.VarChar(200)
}
