export type Region = {
  name: string;
  slug: string;
  type: "kabupaten" | "kota";
};

export const jatengRegions: Region[] = [
  {name:"Kabupaten Cilacap",slug:"kabupaten-cilacap",type:"kabupaten"},
  {name:"Kabupaten Banyumas",slug:"kabupaten-banyumas",type:"kabupaten"},
  {name:"Kabupaten Purbalingga",slug:"kabupaten-purbalingga",type:"kabupaten"},
  {name:"Kabupaten Banjarnegara",slug:"kabupaten-banjarnegara",type:"kabupaten"},
  {name:"Kabupaten Kebumen",slug:"kabupaten-kebumen",type:"kabupaten"},
  {name:"Kabupaten Purworejo",slug:"kabupaten-purworejo",type:"kabupaten"},
  {name:"Kabupaten Wonosobo",slug:"kabupaten-wonosobo",type:"kabupaten"},
  {name:"Kabupaten Magelang",slug:"kabupaten-magelang",type:"kabupaten"},
  {name:"Kabupaten Boyolali",slug:"kabupaten-boyolali",type:"kabupaten"},
  {name:"Kabupaten Klaten",slug:"kabupaten-klaten",type:"kabupaten"},
  {name:"Kabupaten Sukoharjo",slug:"kabupaten-sukoharjo",type:"kabupaten"},
  {name:"Kabupaten Wonogiri",slug:"kabupaten-wonogiri",type:"kabupaten"},
  {name:"Kabupaten Karanganyar",slug:"kabupaten-karanganyar",type:"kabupaten"},
  {name:"Kabupaten Sragen",slug:"kabupaten-sragen",type:"kabupaten"},
  {name:"Kabupaten Grobogan",slug:"kabupaten-grobogan",type:"kabupaten"},
  {name:"Kabupaten Blora",slug:"kabupaten-blora",type:"kabupaten"},
  {name:"Kabupaten Rembang",slug:"kabupaten-rembang",type:"kabupaten"},
  {name:"Kabupaten Pati",slug:"kabupaten-pati",type:"kabupaten"},
  {name:"Kabupaten Kudus",slug:"kabupaten-kudus",type:"kabupaten"},
  {name:"Kabupaten Jepara",slug:"kabupaten-jepara",type:"kabupaten"},
  {name:"Kabupaten Demak",slug:"kabupaten-demak",type:"kabupaten"},
  {name:"Kabupaten Semarang",slug:"kabupaten-semarang",type:"kabupaten"},
  {name:"Kabupaten Temanggung",slug:"kabupaten-temanggung",type:"kabupaten"},
  {name:"Kabupaten Kendal",slug:"kabupaten-kendal",type:"kabupaten"},
  {name:"Kabupaten Batang",slug:"kabupaten-batang",type:"kabupaten"},
  {name:"Kabupaten Pekalongan",slug:"kabupaten-pekalongan",type:"kabupaten"},
  {name:"Kabupaten Pemalang",slug:"kabupaten-pemalang",type:"kabupaten"},
  {name:"Kabupaten Tegal",slug:"kabupaten-tegal",type:"kabupaten"},
  {name:"Kabupaten Brebes",slug:"kabupaten-brebes",type:"kabupaten"},
  {name:"Kota Magelang",slug:"kota-magelang",type:"kota"},
  {name:"Kota Surakarta",slug:"kota-surakarta",type:"kota"},
  {name:"Kota Salatiga",slug:"kota-salatiga",type:"kota"},
  {name:"Kota Semarang",slug:"kota-semarang",type:"kota"},
  {name:"Kota Pekalongan",slug:"kota-pekalongan",type:"kota"},
  {name:"Kota Tegal",slug:"kota-tegal",type:"kota"}
];

export type SemarangDistrict = { name:string; slug:string; villages:string[] };

export const semarangDistricts: SemarangDistrict[] = [
  {name:"Mijen",slug:"mijen",villages:["Cangkiran","Bubakan","Karangmalang","Polaman","Purwosari","Tambangan","Jatisari","Mijen","Jatibarang","Kedungpane","Pesantren","Ngadirgo","Wonolopo","Wonoplumbon"]},
  {name:"Gunungpati",slug:"gunungpati",villages:["Gunungpati","Plalangan","Sumurrejo","Pakintelan","Mangunsari","Patemon","Ngijo","Nongkosawit","Cepoko","Jatirejo","Kandri","Pongangan","Kalisegoro","Sekaran","Sukorejo","Sadeng"]},
  {name:"Banyumanik",slug:"banyumanik",villages:["Banyumanik","Gedawang","Jabungan","Ngesrep","Padangsari","Pedalangan","Pudakpayung","Srondol Kulon","Srondol Wetan","Sumurboto","Tinjomoyo"]},
  {name:"Gajahmungkur",slug:"gajahmungkur",villages:["Bendan Duwur","Bendan Ngisor","Bendungan","Gajahmungkur","Karangrejo","Lempongsari","Petompon","Sampangan"]},
  {name:"Semarang Selatan",slug:"semarang-selatan",villages:["Bulustalan","Barusari","Randusari","Mugassari","Pleburan","Wonodri","Peterongan","Lamper Kidul","Lamper Lor","Lamper Tengah"]},
  {name:"Candisari",slug:"candisari",villages:["Jatingaleh","Karanganyar Gunung","Jomblang","Candi","Kaliwiru","Wonotingal","Tegalsari"]},
  {name:"Tembalang",slug:"tembalang",villages:["Bulusan","Jangli","Kedungmundu","Kramas","Mangunharjo","Meteseh","Rowosari","Sambiroto","Sendangguwo","Sendangmulyo","Tandang","Tembalang"]},
  {name:"Pedurungan",slug:"pedurungan",villages:["Gemah","Kalicari","Muktiharjo Kidul","Palebon","Pedurungan Kidul","Pedurungan Lor","Pedurungan Tengah","Penggaron Kidul","Plamongansari","Tlogosari Kulon","Tlogosari Wetan","Tlogomulyo"]},
  {name:"Genuk",slug:"genuk",villages:["Bangetayu Kulon","Bangetayu Wetan","Banjardowo","Gebangsari","Genuksari","Karangroto","Kudu","Muktiharjo Lor","Penggaron Lor","Sembungharjo","Terboyo Kulon","Terboyo Wetan","Trimulyo"]},
  {name:"Gayamsari",slug:"gayamsari",villages:["Pandean Lamper","Gayamsari","Siwalan","Sambirejo","Sawah Besar","Kaligawe","Tambakrejo"]},
  {name:"Semarang Timur",slug:"semarang-timur",villages:["Karangturi","Karangtempel","Rejosari","Sarirejo","Kebonagung","Bugangan","Mlatiharjo","Mlatibaru","Rejomulyo","Kemijen"]},
  {name:"Semarang Utara",slug:"semarang-utara",villages:["Bulu Lor","Plombokan","Panggung Kidul","Panggung Lor","Kuningan","Purwosari","Dadapsari","Bandarharjo","Tanjung Mas"]},
  {name:"Semarang Tengah",slug:"semarang-tengah",villages:["Pekunden","Karangkidul","Jagalan","Brumbungan","Miroto","Gabahan","Kranggan","Purwodinatan","Kauman","Bangunharjo","Kembangsari","Pandansari","Sekayu","Pindrikan Kidul","Pindrikan Lor"]},
  {name:"Semarang Barat",slug:"semarang-barat",villages:["Kembangarum","Manyaran","Ngemplak Simongan","Bongsari","Bojongsalaman","Cabean","Salamanmloyo","Gisikdrono","Kalibanteng Kidul","Kalibanteng Kulon","Krapyak","Tambakharjo","Tawangsari","Karangayu","Krobokan","Tawangmas"]},
  {name:"Tugu",slug:"tugu",villages:["Jerakah","Tugurejo","Karanganyar","Randugarut","Mangkang Wetan","Mangunharjo","Mangkang Kulon"]},
  {name:"Ngaliyan",slug:"ngaliyan",villages:["Podorejo","Wates","Bringin","Ngaliyan","Bambankerep","Kalipancur","Purwoyoso","Tambakaji","Gondoriyo","Wonosari"]}
];

export function slugify(v:string){
  return v.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g,'').replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'');
}

export const semarangVillageCount = semarangDistricts.reduce((n,d)=>n+d.villages.length,0);
