<?php

function antigua_barbuda_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' => 28,
      'country_name' => 'Antigua and Barbuda',
      'country_iso_code_2' => 'AG',
      'country_iso_code_3' => 'ATG',
      'version' => 1,
    ))
    ->execute();

  $zones = array(
    array(28, 'GE', 'St. George'),
    array(28, 'JO', 'St. John'),
    array(28, 'MA', 'St. Mary'),
    array(28, 'PA', 'St. Paul'),
    array(28, 'PE', 'St. Peter'),
    array(28, 'BB', 'Barbuda'),
    array(28, 'RD', 'Redonda'),
    array(28, 'PH', 'St. Philip'),
  );

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