<?php
/**
 * Eastern Europe city data — 12 countries × 3–6 cities.
 *
 * Each city entry includes: name, region, verified gov_url (for prompt context / factual grounding),
 * and the country_gov_url. These URLs are NEVER injected as outbound links —
 * they provide GPT with verified institutional references to prevent hallucination
 * of fake government sources.
 *
 * Corporate formation data sourced from the Central & Eastern Europe Corporate Comparison
 * spreadsheet — used to inject verified facts into GPT prompts.
 *
 * @since 3.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit;

class DBA_EEurope_Cities {

    /**
     * Get all city data keyed by country.
     *
     * @return array
     */
    public static function get_all() {
        return array(

            'poland' => array(
                array( 'name' => 'Warsaw',   'region' => 'Masovian Voivodeship',       'gov_url' => 'um.warszawa.pl' ),
                array( 'name' => 'Kraków',   'region' => 'Lesser Poland Voivodeship',   'gov_url' => 'krakow.pl' ),
                array( 'name' => 'Łódź',     'region' => 'Łódź Voivodeship',           'gov_url' => 'uml.lodz.pl' ),
                array( 'name' => 'Wrocław',  'region' => 'Lower Silesian Voivodeship', 'gov_url' => 'wroclaw.pl' ),
                array( 'name' => 'Poznań',   'region' => 'Greater Poland Voivodeship', 'gov_url' => 'poznan.pl' ),
                array( 'name' => 'Gdańsk',   'region' => 'Pomeranian Voivodeship',     'gov_url' => 'gdansk.pl' ),
            ),

            'czech_republic' => array(
                array( 'name' => 'Prague',   'region' => 'Capital City',    'gov_url' => 'praha.eu' ),
                array( 'name' => 'Brno',     'region' => 'South Moravian',  'gov_url' => 'brno.cz' ),
                array( 'name' => 'Ostrava',  'region' => 'Moravian-Silesian', 'gov_url' => 'ostrava.cz' ),
            ),

            'serbia' => array(
                array( 'name' => 'Belgrade', 'region' => 'Belgrade District',       'gov_url' => 'beograd.rs' ),
                array( 'name' => 'Novi Sad', 'region' => 'Autonomous Province of Vojvodina', 'gov_url' => 'novisad.rs' ),
                array( 'name' => 'Niš',      'region' => 'Nišava District',         'gov_url' => 'ni.rs' ),
            ),

            'croatia' => array(
                array( 'name' => 'Zagreb',   'region' => 'City of Zagreb',     'gov_url' => 'zagreb.hr' ),
                array( 'name' => 'Split',    'region' => 'Split-Dalmatia County', 'gov_url' => 'split.hr' ),
                array( 'name' => 'Rijeka',   'region' => 'Primorje-Gorski Kotar County', 'gov_url' => 'rijeka.hr' ),
            ),

            'slovenia' => array(
                array( 'name' => 'Ljubljana', 'region' => 'Central Slovenia',    'gov_url' => 'ljubljana.si' ),
                array( 'name' => 'Maribor',   'region' => 'Drava Statistical Region', 'gov_url' => 'maribor.si' ),
                array( 'name' => 'Celje',     'region' => 'Savinja Statistical Region', 'gov_url' => 'celje.si' ),
            ),

            'slovakia' => array(
                array( 'name' => 'Bratislava', 'region' => 'Bratislava Region', 'gov_url' => 'bratislava.sk' ),
                array( 'name' => 'Košice',     'region' => 'Košice Region',     'gov_url' => 'kosice.sk' ),
                array( 'name' => 'Prešov',     'region' => 'Prešov Region',    'gov_url' => 'presov.sk' ),
            ),

            'hungary' => array(
                array( 'name' => 'Budapest', 'region' => 'Central Hungary',  'gov_url' => 'budapest.hu' ),
                array( 'name' => 'Debrecen', 'region' => 'Northern Great Plain', 'gov_url' => 'debrecen.hu' ),
                array( 'name' => 'Szeged',   'region' => 'Southern Great Plain', 'gov_url' => 'szeged.hu' ),
            ),

            'romania' => array(
                array( 'name' => 'Bucharest',   'region' => 'Bucharest-Ilfov',   'gov_url' => 'pmb.ro' ),
                array( 'name' => 'Cluj-Napoca', 'region' => 'North-West Region', 'gov_url' => 'primariaclujnapoca.ro' ),
                array( 'name' => 'Timișoara',   'region' => 'West Region',       'gov_url' => 'primariatm.ro' ),
            ),

            'bulgaria' => array(
                array( 'name' => 'Sofia',   'region' => 'Sofia Capital Province',  'gov_url' => 'sofia.bg' ),
                array( 'name' => 'Plovdiv', 'region' => 'Plovdiv Province',        'gov_url' => 'plovdiv.bg' ),
                array( 'name' => 'Varna',   'region' => 'Varna Province',          'gov_url' => 'varna.bg' ),
            ),

            'estonia' => array(
                array( 'name' => 'Tallinn', 'region' => 'Harju County',    'gov_url' => 'tallinn.ee' ),
                array( 'name' => 'Tartu',   'region' => 'Tartu County',    'gov_url' => 'tartu.ee' ),
                array( 'name' => 'Narva',   'region' => 'Ida-Viru County', 'gov_url' => 'narva.ee' ),
            ),

            'latvia' => array(
                array( 'name' => 'Riga',       'region' => 'Riga Planning Region',    'gov_url' => 'riga.lv' ),
                array( 'name' => 'Daugavpils', 'region' => 'Latgale Planning Region', 'gov_url' => 'daugavpils.lv' ),
                array( 'name' => 'Liepāja',    'region' => 'Kurzeme Planning Region', 'gov_url' => 'liepaja.lv' ),
            ),

            'lithuania' => array(
                array( 'name' => 'Vilnius',   'region' => 'Vilnius County',   'gov_url' => 'vilnius.lt' ),
                array( 'name' => 'Kaunas',    'region' => 'Kaunas County',    'gov_url' => 'kaunas.lt' ),
                array( 'name' => 'Klaipėda',  'region' => 'Klaipėda County',  'gov_url' => 'klaipeda.lt' ),
            ),
        );
    }

    /**
     * Get cities for a single country.
     *
     * @param  string $country_key
     * @return array
     */
    public static function get_country_cities( $country_key ) {
        $all = self::get_all();
        return isset( $all[ $country_key ] ) ? $all[ $country_key ] : array();
    }

    /**
     * Verified government portals per country.
     * Used exclusively as factual anchors in GPT prompts — never injected as outbound links.
     *
     * @return array country_key => gov_domain
     */
    public static function get_government_portals() {
        return array(
            'poland'         => 'gov.pl',
            'czech_republic' => 'gov.cz',
            'serbia'         => 'srbija.gov.rs',
            'croatia'        => 'gov.hr',
            'slovenia'       => 'gov.si',
            'slovakia'       => 'gov.sk',
            'hungary'        => 'kormany.hu',
            'romania'        => 'gov.ro',
            'bulgaria'       => 'gov.bg',
            'estonia'        => 'valitsus.ee',
            'latvia'         => 'gov.lv',
            'lithuania'      => 'lrv.lt',
        );
    }

    /**
     * Verified corporate formation data from the CEE Corporate Comparison spreadsheet.
     * Used to inject REAL facts into GPT prompts — combats hallucination of fake legal data.
     *
     * @return array country_key => corporate data
     */
    public static function get_corporate_data() {
        return array(
            'poland' => array(
                'legal_form'      => 'Sp. z o.o.',
                'min_capital'     => 'PLN 5,000',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '19% (9% reduced for eligible small taxpayers)',
                'management'      => 'Management Board; Supervisory Board optional',
            ),
            'czech_republic' => array(
                'legal_form'      => 's.r.o.',
                'min_capital'     => 'CZK 1',
                'liability'       => 'Limited to unpaid contributions',
                'cit_rate'        => '21%',
                'management'      => 'One or more Executive Directors; Shareholders\' meeting',
            ),
            'serbia' => array(
                'legal_form'      => 'd.o.o.',
                'min_capital'     => 'RSD 100',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '15%',
                'management'      => 'Director(s); Shareholders\' assembly',
            ),
            'croatia' => array(
                'legal_form'      => 'd.o.o.',
                'min_capital'     => 'EUR 2,500',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '18% (lower rate for small companies may apply)',
                'management'      => 'Management Board; Supervisory Board typical for larger entities',
            ),
            'slovenia' => array(
                'legal_form'      => 'd.o.o.',
                'min_capital'     => 'EUR 7,500',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '22%',
                'management'      => 'One or more Directors; Shareholders\' meeting',
            ),
            'slovakia' => array(
                'legal_form'      => 's.r.o.',
                'min_capital'     => 'EUR 5,000',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '21% (tiered system depending on revenue)',
                'management'      => 'One or more Managing Directors; Shareholders\' meeting',
            ),
            'hungary' => array(
                'legal_form'      => 'Kft.',
                'min_capital'     => 'HUF 3,000,000',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '9%',
                'management'      => 'One or more Managing Directors; Members\' meeting',
            ),
            'romania' => array(
                'legal_form'      => 'SRL',
                'min_capital'     => 'RON 500',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '16% or 1% revenue tax for qualifying microenterprises',
                'management'      => 'One or more Administrators; Shareholders\' meeting',
            ),
            'bulgaria' => array(
                'legal_form'      => 'OOD / EOOD',
                'min_capital'     => 'BGN 2',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '10%',
                'management'      => 'One or more Managers; General Meeting',
            ),
            'estonia' => array(
                'legal_form'      => 'OÜ',
                'min_capital'     => 'No statutory minimum',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '22% on distributed profits (22/78 system)',
                'management'      => 'Management Board; Supervisory Board optional',
            ),
            'latvia' => array(
                'legal_form'      => 'SIA',
                'min_capital'     => 'EUR 2,800 (standard) / EUR 1 (low-capital SIA)',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '20% on distributed profits (20/80 system)',
                'management'      => 'Board members; Shareholders\' meeting',
            ),
            'lithuania' => array(
                'legal_form'      => 'UAB',
                'min_capital'     => 'EUR 2,500',
                'liability'       => 'Limited to contributions',
                'cit_rate'        => '16% (reduced rates may apply)',
                'management'      => 'Director or Board; Shareholders\' meeting',
            ),
        );
    }
}
