from typing import Any, Dict, Union

LOCATIONS_URL: Dict[str, Dict[Union[float, int], str]] = {
    "AC": {
        68.1: "rio-branco",
        68.2: "outras-cidades",
    },
    "AL": {82.1: "maceio", 82.2: "outras-cidades"},
    "AP": {
        96.1: "macapa",
        96.2: "outras-cidades",
    },
    "AM": {
        92: "regiao-de-manaus",
        97: "leste-do-amazonas",
    },
    "BA": {
        71: "grande-salvador",
        73: "sul-da-bahia",
        74: "regiao-de-juazeiro-e-jacobina",
        75: "regiao-de-feira-de-santana-e-alagoinhas",
        77: "regiao-de-vitoria-da-conquista-e-barreiras",
    },
    "CE": {
        85: "fortaleza-e-regiao",
        88: "regiao-de-juazeiro-do-norte-e-sobral",
    },
    "DF": {
        61.1: "Brasilia",
        61.2: "outras-cidades",
    },
    "ES": {
        27: "norte-do-espirito-santo",
        28: "sul-do-espirito-santo",
    },
    "GO": {
        62: "grande-goiania-e-anapolis",
        64: "regiao-de-rio-verde-e-caldas-novas",
    },
    "MA": {
        98: "regiao-de-sao-luis",
        99: "regiao-de-imperatriz-e-caxias",
    },
    "MT": {
        65: "regiao-de-cuiaba",
        66: "regiao-de-rondonopolis-e-sinop",
    },
    "MS": {
        67.1: "campo-grande",
        67.2: "corumba",
        67.3: "ourados",
        67.4: "outras-cidades",
        67.5: "tres-lagoas",
    },
    "MG": {
        31: "belo-horizonte-e-regiao",
        32: "regiao-de-juiz-de-fora",
        33: "regiao-de-governador-valadares-e-teofilo-otoni",
        34: "regiao-de-uberlandia-e-uberaba",
        35: "regiao-de-pocos-de-caldas-e-varginha",
        37: "regiao-de-divinopolis",
        38: "regiao-de-montes-claros-e-diamantina",
    },
    "PA": {
        91: "regiao-de-belem",
        93: "regiao-de-santarem",
        94: "regiao-de-maraba",
    },
    "PB": {
        83.1: "joao-pessoa",
        83.2: "campina-grande-guarabira-e-regiao",
        83.3: "monteiro-picui-e-regiao",
        83.4: "patos-sousa-e-regiao",
        83.5: "santa-rita-bayeux-e-regiao",
    },
    "PR": {
        41: "regiao-de-curitiba-e-paranagua",
        42: "regiao-de-ponta-grossa-e-guarapuava",
        43: "regiao-de-londrina",
        44: "regiao-de-maringa",
        45: "regiao-de-foz-do-iguacu-e-cascavel",
        46: "regiao-de-francisco-beltrao-e-pato-branco",
    },
    "PE": {
        81: "grande-recife",
        87: "regiao-de-petrolina-e-garanhuns",
    },
    "PI": {
        86: "regiao-de-teresina-e-parnaiba",
        89: "regiao-de-picos-e-floriano",
    },
    "RJ": {
        21: "rio-de-janeiro-e-regiao",
        22: "norte-do-estado-do-rio",
        24: "serra-angra-dos-reis-e-regiao",
    },
    "RN": {
        84.1: "natal",
        84.2: "outras-cidades",
    },
    "RS": {
        51: "regioes-de-porto-alegre-torres-e-santa-cruz-do-sul",
        53: "regioes-de-pelotas-rio-grande-e-bage",
        54: "regioes-de-caxias-do-sul-e-passo-fundo",
        55: "regioes-de-santa-maria-uruguaiana-e-cruz-alta",
    },
    "RO": {
        69.1: "porto-velho",
        69.2: "outras-cidades",
    },
    "RR": {
        95.1: "boa-vista",
        95.2: "outras-cidades",
    },
    "SC": {
        47: "norte-de-santa-catarina",
        48: "florianopolis-e-regiao",
        49: "oeste-de-santa-catarina",
    },
    "SP": {
        11: "sao-paulo-e-regiao",
        12: "vale-do-paraiba-e-litoral-norte",
        13: "baixada-santista-e-litoral-sul",
        14: "regiao-de-bauru-e-marilia",
        15: "regiao-de-sorocaba",
        16: "regiao-de-ribeirao-preto",
        17: "regiao-de-sao-jose-do-rio-preto",
        18: "regiao-de-presidente-prudente",
        19: "grande-campinas",
    },
    "SE": {
        79.1: "aracaju",
        79.2: "outras-cidades",
    },
    "TO": {
        63.1: "palmas",
        63.2: "outras-cidades",
    },
}

CATEGORIES: Dict = {
    "cars": {
        "category": "autos-e-pecas",
        "subcategories": {
            "parts": "pecas-e-acessorios",
            "cars": "carros-vans-e-utilitarios",
            "motorcycles": "motos",
            "trucks": "caminhoes",
            "bus": "onibus",
            "boats_planes": "barcos-e-aeronaves",
        },
    },
}

MILEAGE: Dict[str, int] = {
    "0": 0,
    "5000": 5_000,
    "10000": 10_000,
    "20000": 20_000,
    "30000": 30_000,
    "40000": 40_000,
    "60000": 60_000,
    "80000": 80_000,
    "100000": 100_000,
    "120000": 120_000,
    "140000": 140_000,
    "160000": 160_000,
    "180000": 180_000,
    "200000": 200_000,
    "250000": 250_000,
    "300000": 300_000,
    "400000": 400_000,
    "500000": 500_000,
}

YEAR: Dict[int, int] = {
    2022: 40,
    2021: 39,
    2020: 38,
    2019: 37,
    2018: 36,
    2017: 35,
    2016: 34,
    2015: 33,
    2014: 32,
    2013: 31,
    2012: 30,
    2011: 29,
    2010: 28,
    2009: 27,
    2008: 26,
    2007: 25,
    2006: 24,
    2005: 23,
    2004: 22,
    2003: 21,
    2002: 20,
    2001: 19,
    2000: 18,
    1999: 17,
    1998: 16,
    1997: 15,
    1996: 14,
    1995: 13,
    1994: 12,
    1993: 11,
    1992: 10,
    1991: 9,
    1990: 8,
    1985: 7,
    1980: 6,
    1975: 5,
    1970: 4,
    1965: 3,
    1960: 2,
    1955: 1,
    1950: 0,
}

ALLOWED_BOOLEAN_FILTERS: Dict[str, Dict[str, Any]] = {
    "new": {"cond": 1},
    "old": {"cond": 2},
    "private": {"f": "p"},
    "professional": {"f": "c"},
    "gasoline": {"fu": 1},
    "alcohol": {"fu": 2},
    "flex": {"fu": 3},
    "gas": {"fu": 4},
    "diesel": {"fu": 5},
    "manual": {"gb": 1},
    "automatic": {"gb": 2},
    "semi_automatic": {"gb": 3},
    "passenger": {"ctp": 1},
    "convertible": {"ctp": 2},
    "pick-up": {"ctp": 3},
    "vintage": {"ctp": 4},
    "suv": {"ctp": 5},
    "buggy": {"ctp": 6},
    "van": {"ctp": 7},
    "sedan": {"ctp": 8},
    "hatch": {"ctp": 9},
    "air_conditioner": {"cf": 1},
    "hydraulic_steering": {"cf": 2},
    "electric_lock": {"cf": 3},
    "electric_window": {"cf": 4},
    "air_bag": {"cf": 5},
    "alarm": {"cf": 6},
    "sound": {"cf": 7},
    "rear_sensor": {"cf": 8},
    "rear_camera": {"cf": 9},
    "armored": {"cf": 10},
}

ALLOWED_DYNAMIC_FILTERS: Dict[str, Dict[str, Any]] = {
    "min_mileage": {
        "filter_name": "ms",
        "has_parse_dict": True,
        "parse_dict": MILEAGE,
    },
    "max_mileage": {
        "filter_name": "me",
        "has_parse_dict": True,
        "parse_dict": MILEAGE,
    },
    "min_year": {
        "filter_name": "rs",
        "has_parse_dict": True,
        "parse_dict": YEAR,
    },
    "max_year": {
        "filter_name": "re",
        "has_parse_dict": True,
        "parse_dict": YEAR,
    },
    "min_price": {
        "filter_name": "ps",
        "has_parse_dict": False,
    },
    "max_price": {
        "filter_name": "pe",
        "has_parse_dict": False,
    },
}
