<?php

function chile_install() {
  // 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 (152, 'Chile', 'CL', 'CHL', 1)");

  // Make the entries in the zones table.
  $zones = array(
    array(152, 'TA', 'Tarapaca'),
    array(152, 'AN', 'Antofagasta'),
    array(152, 'AT', 'Atacama'),
    array(152, 'CO', 'Coquimbo'),
    array(152, 'VA', 'Valparaiso'),
    array(152, 'OH', 'Ohiggins'),
    array(152, 'MA', 'Maule'),
    array(152, 'BI', 'Biobio'),
    array(152, 'AR', 'Araucania'),
    array(152, 'LA', 'Lagos'),
    array(152, 'AI', 'Aisen'),
    array(152, 'MA', 'Magallanes'),
    array(152, 'RM', 'Metropolitana'),
    array(152, 'Ri', 'Rios'),
    array(152, 'AR', 'Arica'),
  );

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

  uc_set_address_format(152, "!company\r\n!first_name !last_name\r\n!street1\r\n!street2"
                           ."\r\n!city, !postal_code\r\n!zone_name, !country_name");
}
