"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStateCountry = exports.getCountries = void 0;
const countries_json_1 = __importDefault(require("../public/countries.json"));
const getCountries = () => {
    return countries_json_1.default.map((country) => ({
        code: country.code2,
        name: country.name,
        states: country.states.map((state) => ({
            name: state.name,
            code: state.code
        }))
    }));
};
exports.getCountries = getCountries;
const getStateCountry = (country) => {
    const selectedCountry = getCountries().find((countryItem) => countryItem.code === country || countryItem.name === country);
    if (!selectedCountry)
        return [];
    return selectedCountry.states || [];
};
exports.getStateCountry = getStateCountry;
