# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict

STATE_ABBREVIATIONS = {
    'US': {
        'AL': {'en': 'Alabama'},
        'AK': {'en': 'Alaska'},
        'AZ': {'en': 'Arizona'},
        'AR': {'en': 'Arkansas'},
        'CA': {'en': 'California'},
        'CO': {'en': 'Colorado'},
        'CT': {'en': 'Connecticut'},
        'DE': {'en': 'Delaware'},
        'DC': {'en': 'District of Columbia'},
        'FL': {'en': 'Florida'},
        'GA': {'en': 'Georgia'},
        'HI': {'en': 'Hawaii'},
        'ID': {'en': 'Idaho'},
        'IL': {'en': 'Illinois'},
        'IN': {'en': 'Indiana'},
        'IA': {'en': 'Iowa'},
        'KS': {'en': 'Kansas'},
        'LA': {'en': 'Louisiana'},
        'KY': {'en': 'Kentucky'},
        'ME': {'en': 'Maine'},
        'MD': {'en': 'Maryland'},
        'MA': {'en': 'Massachusetts'},
        'MI': {'en': 'Michigan'},
        'MN': {'en': 'Minnesota'},
        'MS': {'en': 'Mississippi'},
        'MO': {'en': 'Missouri'},
        'MT': {'en': 'Montana'},
        'NE': {'en': 'Nebraska'},
        'NV': {'en': 'Nevada'},
        'NH': {'en': 'New Hampshire'},
        'NJ': {'en': 'New Jersey'},
        'NM': {'en': 'New Mexico'},
        'NY': {'en': 'New York'},
        'NC': {'en': 'North Carolina'},
        'ND': {'en': 'North Dakota'},
        'OH': {'en': 'Ohio'},
        'OK': {'en': 'Oklahoma'},
        'OR': {'en': 'Oregon'},
        'PA': {'en': 'Pennsylvania'},
        'RI': {'en': 'Rhode Island'},
        'SC': {'en': 'South Carolina'},
        'SD': {'en': 'South Dakota'},
        'TN': {'en': 'Tennessee'},
        'TX': {'en': 'Texas'},
        'UT': {'en': 'Utah'},
        'VT': {'en': 'Vermont'},
        'VA': {'en': 'Virginia'},
        'WA': {'en': 'Washington'},
        'WV': {'en': 'West Virginia'},
        'WI': {'en': 'Wisconsin'},
        'WY': {'en': 'Wyoming'}
    },
    'CA': {
        'AB': {'en': 'Alberta', 'fr': 'Alberta'},
        'BC': {'en': 'British Columbia', 'fr': 'Colombie-Britannique'},
        'MB': {'en': 'Manitoba', 'fr': 'Manitoba'},
        'NB': {'en': 'New Brunswick', 'fr': 'Nouveau-Brunswick'},
        'NL': {'en': 'Newfoundland and Labrador', 'fr': 'Terre-Neuve-et-Labrador'},
        'NS': {'en': 'Nova Scotia', 'fr': 'Nouvelle-Écosse'},
        'NT': {'en': 'Northwest Territories', 'fr': 'Territoires du Nord-Ouest'},
        'NU': {'en': 'Nunavut', 'fr': 'Nunavut'},
        'ON': {'en': 'Ontario', 'fr': 'Ontario'},
        'PE': {'en': 'Prince Edward Island', 'fr': 'Île-du-Prince-Édouard'},
        'QC': {'en': 'Quebec', 'fr': 'Québec'},
        'SK': {'en': 'Saskatchewan', 'fr': 'Saskatchewan'},
        'YT': {'en': 'Yukon', 'fr': 'Yukon'},
    },
    'AU': {
        'AAT': {'en': 'Australian Antarctic Territory'},
        'ACT': {'en': 'Australian Capital Territory'},
        'JBT': {'en': 'Jervis Bay Territory'},
        'NSW': {'en': 'New South Wales'},
        'NT': {'en': 'Northern Territory'},
        'QLD': {'en': 'Queensland'},
        'SA': {'en': 'South Australia'},
        'TAS': {'en': 'Tasmania'},
        'VIC': {'en': 'Victoria'},
        'WA': {'en': 'Western Australia'},
    },
}

STATE_EXPANSIONS = defaultdict(dict)

for country, values in STATE_ABBREVIATIONS.iteritems():
    for abbrev, expansions in values.iteritems():
        for lang, expansion in expansions.iteritems():
            STATE_EXPANSIONS[country][expansion] = abbrev
