<?php

/**
 * Implements hook_install() using the name of the country as the base of
 * the function name.
 */
function slovenia_install() {
  // Make the entry in the country table.
  // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  db_insert('uc_countries')
    ->fields(array(
      'country_id' => 705,
      'country_name' => 'Slovenia',
      'country_iso_code_2' =>'SI',
      'country_iso_code_3' => 'SVN',
      'version' => 1,
    ))
    ->execute();

  // Make the entries in the zones table.
  $zones = array(
    array(705, '002', 'Beltinci'),
    array(705, '148', 'Benedikt'),
    array(705, '149', 'Bistrica ob Sotli'),
    array(705, '003', 'Bled'),
    array(705, '150', 'Bloke'),
    array(705, '004', 'Bohinj'),
    array(705, '005', 'Borovnica'),
    array(705, '006', 'Bovec'),
    array(705, '151', 'Braslovce'),
    array(705, '007', 'Brda'),
    array(705, '009', 'Brezice'),
    array(705, '008', 'Brezovica'),
    array(705, '152', 'Cankova'),
    array(705, '011', 'Celje'),
    array(705, '012', 'Cerklje na Gorenjskem'),
    array(705, '013', 'Cerknica'),
    array(705, '014', 'Cerkno'),
    array(705, '153', 'Cerkvenjak'),
    array(705, '015', 'Crensovci'),
    array(705, '016', 'Crna na Koroskem'),
    array(705, '017', 'Crnomelj'),
    array(705, '018', 'Destrnik'),
    array(705, '019', 'Divaca'),
    array(705, '154', 'Dobje'),
    array(705, '020', 'Dobrepolje'),
    array(705, '155', 'Dobrna'),
    array(705, '021', 'Dobrova-Horjul-Polhov Gradec'),
    array(705, '156', 'Dobrovnik'),
    array(705, '022', 'Dol pri Ljublijani'),
    array(705, '157', 'Dolenjske Toplice'),
    array(705, '023', 'Domzale'),
    array(705, '024', 'Dornava'),
    array(705, '025', 'Dravograd'),
    array(705, '026', 'Duplek'),
    array(705, '027', 'Gorenja vas-Poljane'),
    array(705, '028', 'Gorisnica'),
    array(705, '029', 'Gornja Radgona'),
    array(705, '030', 'Gornji Grad'),
    array(705, '031', 'Gornji Petrovci'),
    array(705, '158', 'Grad'),
    array(705, '032', 'Grosuplje'),
    array(705, '159', 'Hajdina'),
    array(705, '160', 'Hoce-Slivnica'),
    array(705, '161', 'Hodos'),
    array(705, '162', 'Horjul'),
    array(705, '034', 'Hrastnik'),
    array(705, '035', 'Hrpelje-Kozina'),
    array(705, '036', 'Idrija'),
    array(705, '037', 'Ig'),
    array(705, '038', 'Illirska Bistrica'),
    array(705, '039', 'Ivancna Gorica'),
    array(705, '040', 'Izola/Isola'),
    array(705, '041', 'Jesenice'),
    array(705, '163', 'Jezersko'),
    array(705, '042', 'Jursinci'),
    array(705, '043', 'Kamnik'),
    array(705, '044', 'Kanal'),
    array(705, '045', 'Kidricevo'),
    array(705, '046', 'Kobarid'),
    array(705, '047', 'Kobilje'),
    array(705, '048', 'Kocevje'),
    array(705, '049', 'Komen'),
    array(705, '164', 'Komenda'),
    array(705, '050', 'Koper/Capodistria'),
    array(705, '165', 'Kostel'),
    array(705, '051', 'Kozje'),
    array(705, '052', 'Kranj'),
    array(705, '053', 'Kranjska Gora'),
    array(705, '166', 'Krizevci'),
    array(705, '054', 'Krsko'),
    array(705, '055', 'Kungota'),
    array(705, '056', 'Kuzma'),
    array(705, '057', 'Lasko'),
    array(705, '058', 'Lenart'),
    array(705, '059', 'Lendava'),
    array(705, '060', 'Litija'),
    array(705, '061', 'Ljubljana'),
    array(705, '062', 'Ljubno'),
    array(705, '063', 'Ljutomer'),
    array(705, '064', 'Logatec'),
    array(705, '065', 'Loska Dolina'),
    array(705, '066', 'Loski Potok'),
    array(705, '167', 'Lovrenc na Pohorju'),
    array(705, '067', 'Luce'),
    array(705, '068', 'Lukovica'),
    array(705, '069', 'Majsperk'),
    array(705, '070', 'Maribor'),
    array(705, '168', 'Markovci'),
    array(705, '071', 'Medvode'),
    array(705, '072', 'Menges'),
    array(705, '073', 'Metlika'),
    array(705, '074', 'Mezica'),
    array(705, '169', 'Miklavz na Dravskem Polju'),
    array(705, '075', 'Miren-Kostanjevica'),
    array(705, '170', 'Mirna Pec'),
    array(705, '076', 'Mislinja'),
    array(705, '077', 'Moravce'),
    array(705, '078', 'Moravske Toplice'),
    array(705, '079', 'Mozirje'),
    array(705, '080', 'Murska Sobota'),
    array(705, '081', 'Muta'),
    array(705, '082', 'Naklo'),
    array(705, '083', 'Nazarje'),
    array(705, '084', 'Nova Gorica'),
    array(705, '085', 'Novo Mesto'),
    array(705, '086', 'Odranci'),
    array(705, '171', 'Oplotnica'),
    array(705, '087', 'Ormoz'),
    array(705, '088', 'Osilnica'),
    array(705, '089', 'Pesnica'),
    array(705, '090', 'Piran'),
    array(705, '090', 'Pirano'),
    array(705, '091', 'Pivka'),
    array(705, '092', 'Podcetrtek'),
    array(705, '172', 'Podlehnik'),
    array(705, '093', 'Podvelka'),
    array(705, '173', 'Polzela'),
    array(705, '094', 'Postojna'),
    array(705, '174', 'Prebold'),
    array(705, '095', 'Preddvor'),
    array(705, '175', 'Prevalje'),
    array(705, '096', 'Ptuj'),
    array(705, '097', 'Puconci'),
    array(705, '098', 'Race-Fram'),
    array(705, '099', 'Radece'),
    array(705, '100', 'Radenci'),
    array(705, '101', 'Radlje ob Dravi'),
    array(705, '102', 'Radovljica'),
    array(705, '103', 'Ravne na Koroskem'),
    array(705, '176', 'Razkrizje'),
    array(705, '104', 'Ribnica'),
    array(705, '177', 'Ribnica na Pohorju'),
    array(705, '106', 'Rogaska Slatina'),
    array(705, '105', 'Rogasovci'),
    array(705, '107', 'Rogatec'),
    array(705, '108', 'Ruse'),
    array(705, '033', 'Salovci'),
    array(705, '178', 'Selnica ob Dravi'),
    array(705, '109', 'Semic'),
    array(705, '183', 'Sempeter-Vrtojba'),
    array(705, '117', 'Sencur'),
    array(705, '118', 'Sentilj'),
    array(705, '119', 'Sentjernej'),
    array(705, '120', 'Sentjur pri Celju'),
    array(705, '110', 'Sevnica'),
    array(705, '111', 'Sezana'),
    array(705, '121', 'Skocjan'),
    array(705, '122', 'Skofja Loka'),
    array(705, '123', 'Skofljica'),
    array(705, '112', 'Slovenj Gradec'),
    array(705, '113', 'Slovenska Bistrica'),
    array(705, '114', 'Slovenske Konjice'),
    array(705, '124', 'Smarje pri Jelsah'),
    array(705, '125', 'Smartno ob Paki'),
    array(705, '194', 'Smartno pri Litiji'),
    array(705, '179', 'Sodrazica'),
    array(705, '180', 'Solcava'),
    array(705, '126', 'Sostanj'),
    array(705, '115', 'Starse'),
    array(705, '127', 'Store'),
    array(705, '181', 'Sveta Ana'),
    array(705, '182', 'Sveti Andraz v Slovenskih Goricah'),
    array(705, '116', 'Sveti Jurij'),
    array(705, '184', 'Tabor'),
    array(705, '010', 'Tisina'),
    array(705, '128', 'Tolmin'),
    array(705, '129', 'Trbovlje'),
    array(705, '130', 'Trebnje'),
    array(705, '185', 'Trnovska Vas'),
    array(705, '131', 'Trzic'),
    array(705, '186', 'Trzin'),
    array(705, '132', 'Turnisce'),
    array(705, '133', 'Velenje'),
    array(705, '187', 'Velika Polana'),
    array(705, '134', 'Velike Lasce'),
    array(705, '188', 'Verzej'),
    array(705, '135', 'Videm'),
    array(705, '136', 'Vipava'),
    array(705, '137', 'Vitanje'),
    array(705, '138', 'Vodice'),
    array(705, '139', 'Vojnik'),
    array(705, '189', 'Vransko'),
    array(705, '140', 'Vrhnika'),
    array(705, '141', 'Vuzenica'),
    array(705, '142', 'Zagorje ob Savi'),
    array(705, '190', 'Zalec'),
    array(705, '143', 'Zavrc'),
    array(705, '146', 'Zelezniki'),
    array(705, '191', 'Zetale'),
    array(705, '147', 'Ziri'),
    array(705, '192', 'Zirovnica'),
    array(705, '144', 'Zrece'),
    array(705, '193', 'Zuzemberk'),
  );

  $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  foreach ($zones as $zone) {
    $query->values($zone);
  }
  $query->execute();

  // Set address format
  uc_set_address_format(
    705,
    "!company\r\n".
    "!first_name !last_name\r\n".
    "!street1\r\n".
    "!street2\r\n".
    "!city !zone_code !postal_code\r\n".
    "!country_name_if"
  );
}
