<?php

function azerbaijan_install() {
  // Make the entry in the country table.
  // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES (31,'Azerbaijan','AZ','AZE',1)");

  // Make the entries in the zones table.
  $zones = array(
    array(31, 'ABS', 'Absheron'),
    array(31, 'AGM', 'Aghdam'),
    array(31, 'AGS', 'Aghdash'),
    array(31, 'AGC', 'Aghjabedi'),
    array(31, 'AGA', 'Aghstafa'),
    array(31, 'AGU', 'Aghsu'),
    array(31, 'AB', 'Ali-Bairamly'),
    array(31, 'AST', 'Astara'),
    array(31, 'BAB', 'Babek'),
    array(31, 'BA', 'Baku'),
    array(31, 'BAL', 'Balaken'),
    array(31, 'BAR', 'Barda'),
    array(31, 'BEY', 'Beilagan'),
    array(31, 'BIL', 'Bilasuvar'),
    array(31, 'DAS', 'Dashkesan'),
    array(31, 'DAV', 'Devechi'),
    array(31, 'FUZ', 'Fizuli'),
    array(31, 'QAB', 'Gabala'),
    array(31, 'GAD', 'Gadabey'),
    array(31, 'QAX', 'Gakh'),
    array(31, 'GA', 'Ganja'),
    array(31, 'QAZ', 'Gazakh'),
    array(31, 'GOR', 'Geranboy'),
    array(31, 'QOB', 'Gobustan'),
    array(31, 'GOY', 'Goychay'),
    array(31, 'QBA', 'Guba'),
    array(31, 'QBI', 'Gubadly'),
    array(31, 'QUS', 'Gusar'),
    array(31, 'HAC', 'Hacuqabul'),
    array(31, 'IMI', 'Imishli'),
    array(31, 'ISM', 'Ismailly'),
    array(31, 'CAL', 'Jalilabad'),
    array(31, 'CAB', 'Jebrail'),
    array(31, 'CUL', 'Julfa'),
    array(31, 'KAL', 'Kelbajar'),
    array(31, 'XAC', 'Khachmaz'),
    array(31, 'XA', 'Khankendy'),
    array(31, 'XAN', 'Khanlar'),
    array(31, 'XCI', 'Khojaly'),
    array(31, 'XVD', 'Khojavend'),
    array(31, 'XIZ', 'Khyzy'),
    array(31, 'KUR', 'Kyurdamir'),
    array(31, 'LAC', 'Lachin'),
    array(31, 'LAN', 'Lankaran district'),
    array(31, 'LA', 'Lankaran city'),
    array(31, 'LER', 'Lerik'),
    array(31, 'MAS', 'Masally'),
    array(31, 'MI', 'Mingechevir'),
    array(31, 'NA', 'Naftalan'),
    array(31, 'NX', 'Nakhchivan'),
    array(31, 'NEF', 'Neftchala'),
    array(31, 'OGU', 'Oghuz'),
    array(31, 'ORD', 'Ordubad'),
    array(31, 'SAT', 'Saatly'),
    array(31, 'SAB', 'Sabirabad'),
    array(31, 'SAL', 'Salyan'),
    array(31, 'SMX', 'Samuh'),
    array(31, 'SAD', 'Sedarak'),
    array(31, 'SAH', 'Shahbuz'),
    array(31, 'SMI', 'Shamakhy'),
    array(31, 'SKR', 'Shamkir'),
    array(31, 'SAK', 'Sheki district'),
    array(31, 'SA', 'Sheki city'),
    array(31, 'SAR', 'Sherur'),
    array(31, 'SUS', 'Shusha district'),
    array(31, 'SS', 'Shusha city'),
    array(31, 'SIY', 'Siazan'),
    array(31, 'SM', 'Sumgayit'),
    array(31, 'TAR', 'Terter'),
    array(31, 'TOV', 'Tovuz'),
    array(31, 'UCA', 'Ujar'),
    array(31, 'YAR', 'Yardymly'),
    array(31, 'YEV', 'Yevlakh district'),
    array(31, 'YE', 'Yevlakh city'),
    array(31, 'ZAQ', 'Zagatala'),
    array(31, 'ZAN', 'Zangilan'),
    array(31, 'ZAR', 'Zerdab'),
  );

  foreach ($zones as $zone) {
    db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (%d, '%s', '%s')", $zone);
  }

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