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

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

model Layanan {
  id   String @id @default(cuid())
  name String @unique
}

model Potensi {
  id   String @id @default(cuid())
  name String @unique
}

model LandingPage_Layanan {
  id        String @id @default(cuid())
  deksripsi String
}

// ========================================= APPMENU ========================================= //
model AppMenu {
  id           String         @id @default(cuid())
  name         String         @unique
  link         String
  createdAt    DateTime       @default(now())
  updatedAt    DateTime       @updatedAt
  deletedAt    DateTime       @default(now())
  isActive     Boolean        @default(true)
  AppMenuChild AppMenuChild[]
}

// ========================================= APPMENUCHILD ========================================= //
model AppMenuChild {
  id        String   @id @default(cuid())
  name      String   @unique
  link      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
  AppMenu   AppMenu? @relation(fields: [appMenuId], references: [id])
  appMenuId String?
}

// ========================================= FILE STORAGE ========================================= //

model FileStorage {
  id                       String                     @id @default(cuid())
  name                     String                     @unique
  realName                 String
  path                     String
  mimeType                 String
  createdAt                DateTime                   @default(now())
  updatedAt                DateTime                   @updatedAt
  deletedAt                DateTime?
  isActive                 Boolean                    @default(true)
  link                     String
  Berita                   Berita[]
  PotensiDesa              PotensiDesa[]
  Posyandu                 Posyandu[]
  StrukturPPID             StrukturPPID[]
  GalleryFoto              GalleryFoto[]
  PelayananSuratKeterangan PelayananSuratKeterangan[]
  Penghargaan              Penghargaan[]
  ProfileDesaImage         ProfileDesaImage[]
  ProfilePPID              ProfilePPID[]
  ProfilPerbekel           ProfilPerbekel[]
  Puskesmas                Puskesmas[]
  ProgramKesehatan         ProgramKesehatan[]
  PenangananDarurat        PenangananDarurat[]
  KontakDarurat            KontakDarurat[]

  InfoWabahPenyakit InfoWabahPenyakit[]

  KeamananLingkungan KeamananLingkungan[]

  MenuTipsKeamanan MenuTipsKeamanan[]

  Pelapor Pelapor[]

  PasarDesa PasarDesa[]

  KontakDaruratKeamanan KontakDaruratKeamanan[]

  KontakItem KontakItem[]
}

//========================================= MENU PPID ========================================= //

//========================================= STRUKTUR PPID ========================================= //
model StrukturPPID {
  id        String       @id @default(cuid())
  name      String       @db.Text
  image     FileStorage? @relation(fields: [imageId], references: [id])
  imageId   String?
  createdAt DateTime     @default(now())
  updatedAt DateTime     @updatedAt
  deletedAt DateTime     @default(now())
  isActive  Boolean      @default(true)
}

// ========================================= VISI MISI PPID ========================================= //
model VisiMisiPPID {
  id        String   @id @default(cuid())
  visi      String   @db.Text
  misi      String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= DASAR HUKUM PPID ========================================= //
model DasarHukumPPID {
  id        String   @id @default(cuid())
  judul     String   @db.Text
  content   String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= PROFILE PPID ========================================= //
model ProfilePPID {
  id         String       @id @default(cuid())
  name       String       @db.Text
  biodata    String       @db.Text
  riwayat    String       @db.Text
  pengalaman String       @db.Text
  unggulan   String       @db.Text
  imageUrl   String?
  image      FileStorage? @relation(fields: [imageId], references: [id])
  imageId    String?
  createdAt  DateTime     @default(now())
  updatedAt  DateTime     @updatedAt
  deletedAt  DateTime     @default(now())
  isActive   Boolean      @default(true)
}

// ========================================= DAFTAR INFORMASI PUBLIK ========================================= //
model DaftarInformasiPublik {
  id             String   @id @default(cuid())
  jenisInformasi String
  deskripsi      String
  tanggal        String
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
  deletedAt      DateTime @default(now())
  isActive       Boolean  @default(true)
}

//=========================================PERMOHONAN INFORMASI PUBLIK========================= //
model PermohonanInformasiPublik {
  id                               String                          @id @default(cuid())
  nomor                            Int                             @default(autoincrement())
  name                             String
  nik                              String
  notelp                           String
  alamat                           String
  email                            String
  jenisInformasiDiminta            JenisInformasiDiminta?          @relation(fields: [jenisInformasiDimintaId], references: [id])
  jenisInformasiDimintaId          String?
  caraMemperolehInformasi          CaraMemperolehInformasi?        @relation(fields: [caraMemperolehInformasiId], references: [id])
  caraMemperolehInformasiId        String?
  caraMemperolehSalinanInformasi   CaraMemperolehSalinanInformasi? @relation(fields: [caraMemperolehSalinanInformasiId], references: [id])
  caraMemperolehSalinanInformasiId String?
  createdAt                        DateTime                        @default(now())
  updatedAt                        DateTime                        @updatedAt
  deletedAt                        DateTime                        @default(now())
  isActive                         Boolean                         @default(true)
}

model JenisInformasiDiminta {
  id                        String                      @id @default(cuid())
  name                      String                      @unique
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime                    @updatedAt
  deletedAt                 DateTime                    @default(now())
  isActive                  Boolean                     @default(true)
  PermohonanInformasiPublik PermohonanInformasiPublik[]
}

model CaraMemperolehInformasi {
  id                        String                      @id @default(cuid())
  name                      String                      @unique
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime                    @updatedAt
  deletedAt                 DateTime                    @default(now())
  isActive                  Boolean                     @default(true)
  PermohonanInformasiPublik PermohonanInformasiPublik[]
}

model CaraMemperolehSalinanInformasi {
  id                        String                      @id @default(cuid())
  name                      String                      @unique
  createdAt                 DateTime                    @default(now())
  updatedAt                 DateTime                    @updatedAt
  deletedAt                 DateTime                    @default(now())
  isActive                  Boolean                     @default(true)
  PermohonanInformasiPublik PermohonanInformasiPublik[]
}

//=========================================PERMOHONAN INFORMASI KEBERATAN PUBLIK========================= //
model FormulirPermohonanKeberatan {
  id        String   @id @default(cuid())
  name      String
  email     String
  notelp    String
  alasan    String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= IKM ========================================= //
model IndeksKepuasanMasyarakat {
  id        String   @id @default(cuid())
  label     String
  kepuasan  String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model GrafikBerdasarkanJenisKelamin {
  id        String   @id @default(cuid())
  perempuan String
  laki      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model GrafikBerdasarkanResponden {
  id         String   @id @default(cuid())
  sangatbaik String
  baik       String
  kurangbaik String
  tidakbaik  String
  createdAt  DateTime @default(now())
  updatedAt  DateTime @updatedAt
  deletedAt  DateTime @default(now())
  isActive   Boolean  @default(true)
}

model GrafikBerdasarkanUmur {
  id        String   @id @default(cuid())
  remaja    String
  dewasa    String
  orangtua  String
  lansia    String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= MENU DESA ========================================= //
// ========================================= PROFILE DESA ========================================= //
model SejarahDesa {
  id        String   @id @default(cuid())
  judul     String   @db.Text
  deskripsi String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model VisiMisiDesa {
  id        String   @id @default(cuid())
  visi      String   @db.Text
  misi      String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model LambangDesa {
  id        String   @id @default(cuid())
  judul     String
  deskripsi String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model MaskotDesa {
  id        String             @id @default(cuid())
  judul     String
  deskripsi String             @db.Text
  images    ProfileDesaImage[]
  createdAt DateTime           @default(now())
  updatedAt DateTime           @updatedAt
  deletedAt DateTime           @default(now())
  isActive  Boolean            @default(true)
}

model ProfileDesaImage {
  id           String      @id @default(cuid())
  label        String
  image        FileStorage @relation(fields: [imageId], references: [id])
  imageId      String
  MaskotDesa   MaskotDesa  @relation(fields: [maskotDesaId], references: [id])
  maskotDesaId String
}

model ProfilPerbekel {
  id                   String       @id @default(cuid())
  biodata              String       @db.Text
  pengalaman           String       @db.Text
  pengalamanOrganisasi String       @db.Text
  programUnggulan      String       @db.Text
  image                FileStorage? @relation(fields: [imageId], references: [id])
  imageId              String?
  createdAt            DateTime     @default(now())
  updatedAt            DateTime     @updatedAt
  deletedAt            DateTime     @default(now())
  isActive             Boolean      @default(true)
}

// ========================================= BERITA ========================================= //
model Berita {
  id               String          @id @default(cuid())
  judul            String
  deskripsi        String
  image            FileStorage     @relation(fields: [imageId], references: [id])
  imageId          String
  content          String          @db.Text
  createdAt        DateTime        @default(now())
  updatedAt        DateTime        @updatedAt
  deletedAt        DateTime        @default(now())
  isActive         Boolean         @default(true)
  kategoriBerita   KategoriBerita? @relation(fields: [kategoriBeritaId], references: [id])
  kategoriBeritaId String?
}

model KategoriBerita {
  id        String   @id @default(cuid())
  name      String   @unique
  beritas   Berita[]
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= POTENSI DESA ========================================= //
model PotensiDesa {
  id        String      @id @default(cuid())
  name      String
  deskripsi String
  kategori  String
  image     FileStorage @relation(fields: [imageId], references: [id])
  imageId   String
  content   String      @db.Text
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
}

// ========================================= PENGUMUMAN ========================================= //
model Pengumuman {
  id                   String              @id @default(cuid())
  judul                String
  deskripsi            String
  content              String              @db.Text
  createdAt            DateTime            @default(now())
  updatedAt            DateTime            @updatedAt
  deletedAt            DateTime            @default(now())
  isActive             Boolean             @default(true)
  CategoryPengumuman   CategoryPengumuman? @relation(fields: [categoryPengumumanId], references: [id])
  categoryPengumumanId String?
}

model CategoryPengumuman {
  id          String       @id @default(cuid())
  name        String       @unique
  pengumumans Pengumuman[]
  createdAt   DateTime     @default(now())
  updatedAt   DateTime     @updatedAt
  deletedAt   DateTime     @default(now())
  isActive    Boolean      @default(true)
}

// ========================================= GALLERY ========================================= //
model GalleryFoto {
  id               String       @id @default(cuid())
  name             String
  deskripsi        String       @db.Text
  createdAt        DateTime     @default(now())
  updatedAt        DateTime     @updatedAt
  deletedAt        DateTime     @default(now())
  isActive         Boolean      @default(true)
  imagesId         String?      @unique
  imageGalleryFoto FileStorage? @relation(fields: [imagesId], references: [id])
}

model GalleryVideo {
  id        String   @id @default(cuid())
  name      String
  deskripsi String   @db.Text
  linkVideo String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= LAYANAN DESA ========================================= //
model PelayananSuratKeterangan {
  id        String      @id @default(cuid())
  name      String
  deskripsi String      @db.Text
  image     FileStorage @relation(fields: [imageId], references: [id])
  imageId   String
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
}

model PelayananTelunjukSaktiDesa {
  id        String   @id @default(cuid())
  name      String
  deskripsi String   @db.Text
  link      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model PelayananPerizinanBerusaha {
  id        String   @id @default(cuid())
  name      String
  deskripsi String   @db.Text
  link      String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

model PelayananPendudukNonPermanen {
  id        String   @id @default(cuid())
  name      String
  deskripsi String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= PENGHARGAAN ========================================= //
model Penghargaan {
  id        String      @id @default(cuid())
  name      String
  juara     String
  deskripsi String      @db.Text
  image     FileStorage @relation(fields: [imageId], references: [id])
  imageId   String
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
}

// ========================================= MENU KESEHATAN ========================================= //
// ========================================= DATA KESEHATAN WARGA ========================================= //

// ========================================= FASILITAS KESEHATAN ========================================= //
model FasilitasKesehatan {
  id                     String               @id @default(cuid())
  name                   String
  createdAt              DateTime             @default(now())
  updatedAt              DateTime             @updatedAt
  deletedAt              DateTime             @default(now())
  isActive               Boolean              @default(true)
  informasiumum          InformasiUmum        @relation(fields: [informasiUmumId], references: [id])
  informasiUmumId        String
  layananunggulan        LayananUnggulan      @relation(fields: [layananUnggulanId], references: [id])
  layananUnggulanId      String
  dokterdantenagamedis   DokterdanTenagaMedis @relation(fields: [dokterdanTenagaMedisId], references: [id])
  dokterdanTenagaMedisId String
  fasilitaspendukung     FasilitasPendukung   @relation(fields: [fasilitasPendukungId], references: [id])
  fasilitasPendukungId   String
  prosedurpendaftaran    ProsedurPendaftaran  @relation(fields: [prosedurPendaftaranId], references: [id])
  prosedurPendaftaranId  String
  tarifdanlayanan        TarifDanLayanan      @relation(fields: [tarifDanLayananId], references: [id])
  tarifDanLayananId      String
}

model InformasiUmum {
  id                 String               @id @default(cuid())
  fasilitas          String
  alamat             String
  jamOperasional     String
  createdAt          DateTime             @default(now())
  updatedAt          DateTime             @updatedAt
  deletedAt          DateTime             @default(now())
  FasilitasKesehatan FasilitasKesehatan[]
  isActive           Boolean              @default(true)
}

model LayananUnggulan {
  id                 String               @id @default(cuid())
  content            String
  createdAt          DateTime             @default(now())
  updatedAt          DateTime             @updatedAt
  deletedAt          DateTime             @default(now())
  isActive           Boolean              @default(true)
  FasilitasKesehatan FasilitasKesehatan[]
}

model DokterdanTenagaMedis {
  id                 String               @id @default(cuid())
  name               String
  specialist         String
  jadwal             String
  createdAt          DateTime             @default(now())
  updatedAt          DateTime             @updatedAt
  deletedAt          DateTime             @default(now())
  isActive           Boolean              @default(true)
  FasilitasKesehatan FasilitasKesehatan[]
}

model FasilitasPendukung {
  id                 String               @id @default(cuid())
  content            String
  createdAt          DateTime             @default(now())
  updatedAt          DateTime             @updatedAt
  deletedAt          DateTime             @default(now())
  isActive           Boolean              @default(true)
  FasilitasKesehatan FasilitasKesehatan[]
}

model ProsedurPendaftaran {
  id                 String               @id @default(cuid())
  content            String
  createdAt          DateTime             @default(now())
  updatedAt          DateTime             @updatedAt
  deletedAt          DateTime             @default(now())
  isActive           Boolean              @default(true)
  FasilitasKesehatan FasilitasKesehatan[]
}

model TarifDanLayanan {
  id                 String               @id @default(cuid())
  layanan            String
  tarif              String
  createdAt          DateTime             @default(now())
  updatedAt          DateTime             @updatedAt
  deletedAt          DateTime             @default(now())
  isActive           Boolean              @default(true)
  FasilitasKesehatan FasilitasKesehatan[]
}

// ========================================= JADWAL KEGIATAN ========================================= //
model JadwalKegiatan {
  id                              String                        @id @default(cuid())
  content                         String
  informasijadwalkegiatan         InformasiJadwalKegiatan       @relation(fields: [informasiJadwalKegiatanId], references: [id])
  informasiJadwalKegiatanId       String
  deskripsijadwalkegiatan         DeskripsiJadwalKegiatan       @relation(fields: [deskripsiJadwalKegiatanId], references: [id])
  deskripsiJadwalKegiatanId       String
  layananjadwalkegiatan           LayananJadwalKegiatan         @relation(fields: [layananJadwalKegiatanId], references: [id])
  layananJadwalKegiatanId         String
  syaratketentuanjadwalkegiatan   SyaratKetentuanJadwalKegiatan @relation(fields: [syaratKetentuanJadwalKegiatanId], references: [id])
  syaratKetentuanJadwalKegiatanId String
  dokumenjadwalkegiatan           DokumenJadwalKegiatan         @relation(fields: [dokumenJadwalKegiatanId], references: [id])
  dokumenJadwalKegiatanId         String
  pendaftaranjadwalkegiatan       PendaftaranJadwalKegiatan     @relation(fields: [pendaftaranJadwalKegiatanId], references: [id])
  pendaftaranJadwalKegiatanId     String
  createdAt                       DateTime                      @default(now())
  updatedAt                       DateTime                      @updatedAt
  deletedAt                       DateTime                      @default(now())
  isActive                        Boolean                       @default(true)
}

model InformasiJadwalKegiatan {
  id             String           @id @default(cuid())
  name           String
  tanggal        String
  waktu          String
  lokasi         String
  createdAt      DateTime         @default(now())
  updatedAt      DateTime         @updatedAt
  deletedAt      DateTime         @default(now())
  isActive       Boolean          @default(true)
  JadwalKegiatan JadwalKegiatan[]
}

model DeskripsiJadwalKegiatan {
  id             String           @id @default(cuid())
  deskripsi      String
  createdAt      DateTime         @default(now())
  updatedAt      DateTime         @updatedAt
  deletedAt      DateTime         @default(now())
  isActive       Boolean          @default(true)
  JadwalKegiatan JadwalKegiatan[]
}

model LayananJadwalKegiatan {
  id        String   @id @default(cuid())
  content   String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)

  JadwalKegiatan JadwalKegiatan[]
}

model SyaratKetentuanJadwalKegiatan {
  id        String   @id @default(cuid())
  content   String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)

  JadwalKegiatan JadwalKegiatan[]
}

model DokumenJadwalKegiatan {
  id             String           @id @default(cuid())
  content        String
  createdAt      DateTime         @default(now())
  updatedAt      DateTime         @updatedAt
  deletedAt      DateTime         @default(now())
  isActive       Boolean          @default(true)
  JadwalKegiatan JadwalKegiatan[]
}

model PendaftaranJadwalKegiatan {
  id             String           @id @default(cuid())
  name           String
  tanggal        String
  namaOrangtua   String
  nomor          String
  alamat         String
  catatan        String
  createdAt      DateTime         @default(now())
  updatedAt      DateTime         @updatedAt
  deletedAt      DateTime         @default(now())
  isActive       Boolean          @default(true)
  JadwalKegiatan JadwalKegiatan[]
}

// ========================================= PERSENTASE KELAHIRAN & KEMATIAN ========================================= //
model DataKematian_Kelahiran {
  id             String   @id @default(cuid())
  tahun          String
  kematianKasar  String
  kematianBayi   String
  kelahiranKasar String
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
  deletedAt      DateTime @default(now())
  isActive       Boolean  @default(true)
}

// ========================================= GRAFIK KEPUASAN ========================================= //
model GrafikKepuasan {
  id        String   @id @default(cuid())
  label     String
  jumlah    String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)
}

// ========================================= ARTIKEL KESEHATAN ========================================= //
model ArtikelKesehatan {
  id             String       @id @default(cuid())
  title          String
  content        String
  introduction   Introduction @relation(fields: [introductionId], references: [id])
  introductionId String
  symptom        Symptom      @relation(fields: [symptomId], references: [id])
  symptomId      String
  prevention     Prevention   @relation(fields: [preventionId], references: [id])
  preventionId   String
  firstaid       FirstAid     @relation(fields: [firstAidId], references: [id])
  firstAidId     String
  mythvsfact     MythVsFact   @relation(fields: [mythVsFactId], references: [id])
  mythVsFactId   String
  doctorsign     DoctorSign   @relation(fields: [doctorSignId], references: [id])
  doctorSignId   String
  createdAt      DateTime     @default(now())
  updatedAt      DateTime     @updatedAt
  deletedAt      DateTime     @default(now())
  isActive       Boolean      @default(true)
}

model Introduction {
  id               String             @id @default(cuid())
  content          String
  createdAt        DateTime           @default(now())
  updatedAt        DateTime           @updatedAt
  deletedAt        DateTime           @default(now())
  isActive         Boolean            @default(true)
  ArtikelKesehatan ArtikelKesehatan[]
}

model Symptom {
  id               String             @id @default(cuid())
  title            String
  content          String
  createdAt        DateTime           @default(now())
  updatedAt        DateTime           @updatedAt
  deletedAt        DateTime           @default(now())
  isActive         Boolean            @default(true)
  ArtikelKesehatan ArtikelKesehatan[]
}

model Prevention {
  id        String   @id @default(cuid())
  title     String
  content   String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)

  ArtikelKesehatan ArtikelKesehatan[]
}

model FirstAid {
  id        String   @id @default(cuid())
  title     String
  content   String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)

  ArtikelKesehatan ArtikelKesehatan[]
}

model MythVsFact {
  id        String   @id @default(cuid())
  title     String
  mitos     String
  fakta     String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)

  ArtikelKesehatan ArtikelKesehatan[]
}

model DoctorSign {
  id        String   @id @default(cuid())
  content   String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime @default(now())
  isActive  Boolean  @default(true)

  ArtikelKesehatan ArtikelKesehatan[]
}

// ========================================= POSYANDU ========================================= //
model Posyandu {
  id        String      @id @default(cuid())
  name      String
  nomor     String
  deskripsi String
  image     FileStorage @relation(fields: [imageId], references: [id])
  imageId   String
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
}

// ========================================= PUSKESMAS ========================================= //
model Puskesmas {
  id        String          @id @default(cuid())
  name      String
  alamat    String
  jam       JamOperasional  @relation(fields: [jamId], references: [id])
  jamId     String
  image     FileStorage     @relation(fields: [imageId], references: [id])
  imageId   String
  kontak    KontakPuskesmas @relation(fields: [kontakId], references: [id])
  kontakId  String
  createdAt DateTime        @default(now())
  updatedAt DateTime        @updatedAt
  deletedAt DateTime        @default(now())
  isActive  Boolean         @default(true)
}

model JamOperasional {
  id        String      @id @default(cuid())
  workDays  String
  weekDays  String
  holiday   String
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
  Puskesmas Puskesmas[]
}

model KontakPuskesmas {
  id              String      @id @default(cuid())
  kontakPuskesmas String
  email           String
  facebook        String
  kontakUGD       String
  createdAt       DateTime    @default(now())
  updatedAt       DateTime    @updatedAt
  deletedAt       DateTime    @default(now())
  isActive        Boolean     @default(true)
  Puskesmas       Puskesmas[]
}

// ========================================= PROGRAM KESSEHATAN ========================================= //
model ProgramKesehatan {
  id               String      @id @default(cuid())
  name             String
  deskripsiSingkat String
  deskripsi        String
  image            FileStorage @relation(fields: [imageId], references: [id])
  imageId          String
  createdAt        DateTime    @default(now())
  updatedAt        DateTime    @updatedAt
  deletedAt        DateTime    @default(now())
  isActive         Boolean     @default(true)
}

// ========================================= PENANGANAN DARURAT ========================================= //
model PenangananDarurat {
  id        String      @id @default(cuid())
  name      String
  deskripsi String
  image     FileStorage @relation(fields: [imageId], references: [id])
  imageId   String
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
}

// ========================================= KONTAK DARURAT ========================================= //
model KontakDarurat {
  id        String      @id @default(cuid())
  name      String
  deskripsi String
  image     FileStorage @relation(fields: [imageId], references: [id])
  imageId   String
  createdAt DateTime    @default(now())
  updatedAt DateTime    @updatedAt
  deletedAt DateTime    @default(now())
  isActive  Boolean     @default(true)
}

// ========================================= INFO WABAH PENYAKIT ========================================= //
model InfoWabahPenyakit {
  id               String      @id @default(cuid())
  name             String
  deskripsiSingkat String
  deskripsiLengkap String
  image            FileStorage @relation(fields: [imageId], references: [id])
  imageId          String
  createdAt        DateTime    @default(now())
  updatedAt        DateTime    @updatedAt
  deletedAt        DateTime    @default(now())
  isActive         Boolean     @default(true)
}

// ========================================= MENU KEAMANAN ========================================= //
// ========================================= KEAMANAN LINGKUNGAN ========================================= //
model KeamananLingkungan {
  id        String       @id @default(cuid())
  name      String       @db.Text
  deskripsi String       @db.Text
  image     FileStorage? @relation(fields: [imageId], references: [id])
  imageId   String?
  createdAt DateTime     @default(now())
  updatedAt DateTime     @updatedAt
  deletedAt DateTime     @default(now())
  isActive  Boolean      @default(true)
}

// ========================================= POLSEK TERDEKAT ========================================= //
model PolsekTerdekat {
  id               String        @id @default(uuid())
  nama             String
  jarakKeDesa      String
  alamat           String
  nomorTelepon     String
  jamOperasional   String
  embedMapUrl      String
  namaTempatMaps   String
  alamatMaps       String
  linkPetunjukArah String
  layananPolsek    LayananPolsek @relation(fields: [layananPolsekId], references: [id])
  layananPolsekId  String
  createdAt        DateTime      @default(now())
  updatedAt        DateTime      @updatedAt
  deletedAt        DateTime      @default(now())
  isActive         Boolean       @default(true)
}

model LayananPolsek {
  id             String           @id @default(uuid())
  nama           String // contoh: "Pelayanan SKCK", "Laporan Kriminal"
  createdAt      DateTime         @default(now())
  updatedAt      DateTime         @updatedAt
  deletedAt      DateTime?
  isActive       Boolean          @default(true)
  PolsekTerdekat PolsekTerdekat[]
}

// ========================================= KONTAK DARURAT ========================================= //
model KontakDaruratKeamanan {
  id          String       @id @default(uuid())
  nama        String // contoh: "Layanan Darurat", "Fasilitas Kesehatan"
  image       FileStorage? @relation(fields: [imageId], references: [id])
  imageId     String?
  kontakItems KontakItem[]
  createdAt   DateTime     @default(now())
  updatedAt   DateTime     @updatedAt
}

model KontakItem {
  id           String                @id @default(uuid())
  nama         String // contoh: "Polisi", "Ambulans", "Puskesmas Darmasaba"
  nomorTelepon String
  image        FileStorage?          @relation(fields: [imageId], references: [id])
  imageId      String?
  kategori     KontakDaruratKeamanan @relation(fields: [kategoriId], references: [id])
  kategoriId   String
  createdAt    DateTime              @default(now())
  updatedAt    DateTime              @updatedAt
}

// ========================================= PENCEGAHAN KRIMINALITAS ========================================= //
model PencegahanKriminalitas {
  id                String          @id @default(cuid())
  programKeamanan   ProgramKeamanan @relation(fields: [programKeamananId], references: [id])
  programKeamananId String
  tipsKeamanan      TipsKeamanan    @relation(fields: [tipsKeamananId], references: [id])
  tipsKeamananId    String
  videoKeamanan     VideoKeamanan   @relation(fields: [videoKeamananId], references: [id])
  videoKeamananId   String
  createdAt         DateTime        @default(now())
  updatedAt         DateTime        @updatedAt
  deletedAt         DateTime        @default(now())
  isActive          Boolean         @default(true)
}

model ProgramKeamanan {
  id                     String                   @id @default(cuid())
  nama                   String // contoh: "Ronda Malam"
  deskripsi              String? // jika mau tambahkan info detail
  slug                   String                   @unique
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime                 @updatedAt
  PencegahanKriminalitas PencegahanKriminalitas[]
}

model TipsKeamanan {
  id                     String                   @id @default(cuid())
  judul                  String
  konten                 String
  slug                   String
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime                 @updatedAt
  PencegahanKriminalitas PencegahanKriminalitas[]
}

model VideoKeamanan {
  id                     String                   @id @default(cuid())
  judul                  String
  deskripsi              String?
  videoUrl               String // link youtube atau embed url
  slug                   String
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime                 @updatedAt
  PencegahanKriminalitas PencegahanKriminalitas[]
}

// ========================================= LAPORAN PUBLIK ========================================= //
model LaporanPublik {
  id           String                    @id @default(cuid())
  judul        String
  lokasi       String
  tanggalWaktu DateTime
  status       StatusLaporan
  penanganan   PenangananLaporanPublik[]
  kronologi    String? // Optional, bisa diisi detail kronologi
  createdAt    DateTime                  @default(now())
  updatedAt    DateTime                  @updatedAt
}

model PenangananLaporanPublik {
  id        String        @id @default(cuid())
  laporanId String
  deskripsi String
  laporan   LaporanPublik @relation(fields: [laporanId], references: [id], onDelete: Cascade)
}

enum StatusLaporan {
  Selesai
  Proses
  Gagal
}

model Pelapor {
  id           String      @id @default(cuid())
  nama         String
  alamat       String
  nomorTelepon String
  image        FileStorage @relation(fields: [imageId], references: [id])
  imageId      String
}

// ========================================= TIPS KEAMANAN ========================================= //
model MenuTipsKeamanan {
  id        String       @id @default(cuid())
  judul     String
  deskripsi String
  image     FileStorage? @relation(fields: [imageId], references: [id])
  imageId   String?
  createdAt DateTime     @default(now())
  updatedAt DateTime     @updatedAt
  deletedAt DateTime     @default(now())
  isActive  Boolean      @default(true)
}

// ========================================= MENU EKONOMI ========================================= //
// ========================================= PASAR DESA ========================================= //
model PasarDesa {
  id              String            @id @default(uuid())
  nama            String
  image           FileStorage?      @relation(fields: [imageId], references: [id])
  imageId         String?
  harga           Int
  rating          Float
  alamatUsaha     String
  createdAt       DateTime          @default(now())
  updatedAt       DateTime          @updatedAt
  deletedAt       DateTime          @default(now())
  isActive        Boolean           @default(true)
  kategoriProduk  KategoriProduk @relation(fields: [kategoriProdukId], references: [id])
  kategoriProdukId String
  KategoriToPasar KategoriToPasar[]
}

model KategoriProduk {
  id              String            @id @default(uuid())
  nama            String
  createdAt       DateTime          @default(now())
  updatedAt       DateTime          @updatedAt
  deletedAt       DateTime          @default(now())
  isActive        Boolean           @default(true)
  KategoriToPasar KategoriToPasar[]
  PasarDesa PasarDesa[]
}

model KategoriToPasar {
  id          String         @id @default(uuid())
  kategori    KategoriProduk @relation(fields: [kategoriId], references: [id])
  kategoriId  String
  pasarDesa   PasarDesa      @relation(fields: [pasarDesaId], references: [id])
  pasarDesaId String
  createdAt   DateTime       @default(now())
  updatedAt   DateTime       @updatedAt
  deletedAt   DateTime       @default(now())
  isActive    Boolean        @default(true)
}

// ========================================= LOWONGAN KERJA LOKAL ========================================= //
model LowonganPekerjaan {
  id             String   @id @default(uuid()) // ID unik untuk setiap lowongan
  posisi         String // Contoh: "Kasir"
  namaPerusahaan String // Contoh: "Toko Sumber Rejeki"
  lokasi         String // Contoh: "Desa Munggu , Badung"
  tipePekerjaan  String // Contoh: "Full Time", "Part Time", "Contract"
  gaji           String // Contoh: "Rp. 2.500.000 / bulan". Menggunakan String karena formatnya bisa bervariasi
  deskripsi      String // Opsional: Detail deskripsi pekerjaan (tidak terlihat di UI ini, tapi umum ada)
  kualifikasi    String // Opsional: Kualifikasi yang dibutuhkan (tidak terlihat di UI ini, tapi umum ada)
  tanggalPosting DateTime @default(now()) // Tanggal lowongan diposting
  isActive       Boolean  @default(true) // Menandakan apakah lowongan masih aktif
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
  deletedAt      DateTime @default(now())
}

// ========================================= PROGRAM KEMISKINAN ========================================= //
model ProgramKemiskinan {
  id          String               @id @default(uuid())
  nama        String
  deskripsi   String
  ikonUrl     String?
  isActive    Boolean              @default(true)
  // Tambahkan relasi one-to-one ke StatistikKemiskinan
  statistikId String?              @unique // Foreign key ke StatistikKemiskinan, unique untuk one-to-one
  statistik   StatistikKemiskinan? @relation(fields: [statistikId], references: [id])
  createdAt   DateTime             @default(now())
  updatedAt   DateTime             @updatedAt
}

model StatistikKemiskinan {
  id                String             @id @default(uuid())
  tahun             Int                @unique
  jumlah            Int
  // Tidak perlu foreign key di sini jika relasi di ProgramLayanan
  programKemiskinan ProgramKemiskinan?
  createdAt         DateTime           @default(now())
  updatedAt         DateTime           @updatedAt
}
