<?php

function saint_kitts_nevis_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' => 659,
      'country_name' => 'Saint Kitts and Nevis',
      'country_iso_code_2' => 'KN',
      'country_iso_code_3' => 'KNA',
      'version' => 1,
    ))
    ->execute();

  // Make the entries in the zones table.
  $zones = array(
    array(659, 'CCN', 'Christ Church Nichola Town'),
    array(659, 'ASP', 'Saint Anne Sandy Point'),
    array(659, 'GBA', 'Saint George Basseterre'),
    array(659, 'GGI', 'Saint George Gingerland'),
    array(659, 'JWI', 'Saint James Windward'),
    array(659, 'JCA', 'Saint John Capisterre'),
    array(659, 'JFI', 'Saint John Figtree'),
    array(659, 'MCA', 'Saint Mary Cayon'),
    array(659, 'PCA', 'Saint Paul Capisterre'),
    array(659, 'PCH', 'Saint Paul Charlestown'),
    array(659, 'PBS', 'Saint Peter Basseterre'),
    array(659, 'TLO', 'Saint Thomas Lowland'),
    array(659, 'TMI', 'Saint Thomas Middle Island'),
    array(659, 'TPP', 'Trinity Palmetto Point'),
  );

  $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(
    659,
    "!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"
  );
}
