<?php

function sint_maarten_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' => 534,
      'country_name' => 'Sint Maarten',
      'country_iso_code_2' => 'SX',
      'country_iso_code_3' => 'SXM',
      'version' => 1,
    ))
    ->execute();

  // Make the entries in the zones table.
  $zones = array(
    array(534, 'AD', 'Almond Grove'),
    array(534, 'BH', 'Beacon Hill'),
    array(534, 'BV', 'Belvedere'),
    array(534, 'CB', 'Cole Bay'),
    array(534, 'CC', 'Cupecoy'),
    array(534, 'CH', 'Cay Hill'),
    array(534, 'DB', 'Dawn Beach'),
    array(534, 'DC', 'Dutch Cul De Sac'),
    array(534, 'DF', 'Defiance'),
    array(534, 'DQ', 'Dutch Quarter'),
    array(534, 'EZ', 'Ebenezer'),
    array(534, 'FP', 'Fresh Pond'),
    array(534, 'GB', 'Guana Bay'),
    array(534, 'GR', 'Great Bay'),
    array(534, 'HE', 'Hope Estate'),
    array(534, 'KB', 'Cay Bay'),
    array(534, 'LB', 'Little Bay'),
    array(534, 'LL', 'Low Lands'),
    array(534, 'LP', 'Lower Prince Quarter'),
    array(534, 'MA', 'Marian Estate'),
    array(534, 'MB', 'Mullet Bay'),
    array(534, 'MD', 'Madam Estate'),
    array(534, 'MH', 'Maho'),
    array(534, 'ML', 'Middle Land'),
    array(534, 'OP', 'Oyster Pond'),
    array(534, 'PB', 'Point Blanche'),
    array(534, 'PH', 'Philispburg'),
    array(534, 'SB', 'Simpson Bay'),
    array(534, 'SD', 'Saunders'),
    array(534, 'SG', 'Sucker Garden'),
    array(534, 'SP', 'St Peters'),
    array(534, 'SR', 'South Reward'),
    array(534, 'UP', 'Upper Prince Quarter'),
    array(534, 'VY', 'Vineyard'),
  );

  $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(
    534,
    "!company\r\n".
    "!first_name !last_name\r\n".
    "!street1\r\n".
    "!street2\r\n".
    "!city, !zone_code\r\n".
    "!country_name_if"
  );
}
