// Script pour ajouter des écrans dans tous les pays de la DB
// Pour que chaque pays sélectionnable ait des écrans disponibles
import Surreal from 'surrealdb';

const SURREAL_URL = 'wss://gentle-island-06di2pv2c9po3a8euttd1alkek.aws-euw1.surreal.cloud';
const SURREAL_USER = 'rootuser';
const SURREAL_PASS = 'n1n@S1mone';
const SURREAL_NAMESPACE = 'neoad';
const SURREAL_DATABASE = 'neodb';

// Données des pays avec leurs infos géographiques
const countryUpdates: Record<string, {
	name_fr: string;
	name_en: string;
	center_lat: number;
	center_lng: number;
	default_zoom: number;
}> = {
	FR: { name_fr: 'France', name_en: 'France', center_lat: 46.603354, center_lng: 1.888334, default_zoom: 5 },
	ES: { name_fr: 'Espagne', name_en: 'Spain', center_lat: 40.4637, center_lng: -3.7492, default_zoom: 5 },
	BE: { name_fr: 'Belgique', name_en: 'Belgium', center_lat: 50.8503, center_lng: 4.3517, default_zoom: 7 },
	CH: { name_fr: 'Suisse', name_en: 'Switzerland', center_lat: 46.8182, center_lng: 8.2275, default_zoom: 7 },
	LU: { name_fr: 'Luxembourg', name_en: 'Luxembourg', center_lat: 49.6117, center_lng: 6.1300, default_zoom: 9 },
	DE: { name_fr: 'Allemagne', name_en: 'Germany', center_lat: 51.1657, center_lng: 10.4515, default_zoom: 5 },
	IT: { name_fr: 'Italie', name_en: 'Italy', center_lat: 41.8719, center_lng: 12.5674, default_zoom: 5 },
	PT: { name_fr: 'Portugal', name_en: 'Portugal', center_lat: 39.3999, center_lng: -8.2245, default_zoom: 6 },
	GB: { name_fr: 'Royaume-Uni', name_en: 'United Kingdom', center_lat: 55.3781, center_lng: -3.4360, default_zoom: 5 },
};

// Locations et écrans à créer par pays (sauf FR qui en a déjà)
interface LocationData {
	id: string;
	name: string;
	location_type: string; // string value: mall, store, restaurant, outdoor, station, etc.
	address: string;
	city: string;
	postal_code: string;
	region: string;
	department?: string;
	country: string;
	country_code: string;
	latitude: number;
	longitude: number;
	description: string;
	foot_traffic: string;
	timezone: string;
}

interface ScreenData {
	id: string;
	location: string;
	name: string;
	screen_type: string; // led, lcd, projection, interactive
	placement: string; // indoor, outdoor, window, totem, wall, ceiling
	resolution: string;
	width_px: number;
	height_px: number;
	orientation: string;
	aspect_ratio: string;
	size_inches: number;
	daily_impressions: number;
	loop_duration_seconds: number;
	slots_per_loop: number;
	slot_duration_seconds: number;
	price_per_slot: number;
}

const internationalData: Record<string, { locations: LocationData[]; screens: ScreenData[] }> = {
	ES: {
		locations: [
			{
				id: 'location:es_gran_via',
				name: 'Gran Vía Madrid',
				location_type: 'outdoor',
				address: 'Gran Vía 32',
				city: 'Madrid',
				postal_code: '28013',
				region: 'Comunidad de Madrid',
				department: 'Madrid',
				country: 'Spain',
				country_code: 'ES',
				latitude: 40.4200,
				longitude: -3.7025,
				description: 'Artère commerciale principale de Madrid',
				foot_traffic: 'very_high',
				timezone: 'Europe/Madrid'
			},
			{
				id: 'location:es_la_rambla',
				name: 'La Rambla Barcelona',
				location_type: 'outdoor',
				address: 'La Rambla 91',
				city: 'Barcelona',
				postal_code: '08001',
				region: 'Cataluña',
				department: 'Barcelona',
				country: 'Spain',
				country_code: 'ES',
				latitude: 43.3813,
				longitude: 2.1734,
				description: 'La promenade la plus célèbre de Barcelone',
				foot_traffic: 'very_high',
				timezone: 'Europe/Madrid'
			},
			{
				id: 'location:es_cc_diagonal',
				name: 'L\'Illa Diagonal',
				location_type: 'mall',
				address: 'Avinguda Diagonal 557',
				city: 'Barcelona',
				postal_code: '08029',
				region: 'Cataluña',
				department: 'Barcelona',
				country: 'Spain',
				country_code: 'ES',
				latitude: 41.3910,
				longitude: 2.1362,
				description: 'Grand centre commercial sur l\'avenue Diagonal',
				foot_traffic: 'high',
				timezone: 'Europe/Madrid'
			},
			{
				id: 'location:es_estacion_atocha',
				name: 'Estación de Atocha',
				location_type: 'station',
				address: 'Plaza del Emperador Carlos V',
				city: 'Madrid',
				postal_code: '28045',
				region: 'Comunidad de Madrid',
				department: 'Madrid',
				country: 'Spain',
				country_code: 'ES',
				latitude: 40.4065,
				longitude: -3.6930,
				description: 'Gare principale de Madrid',
				foot_traffic: 'very_high',
				timezone: 'Europe/Madrid'
			},
			{
				id: 'location:es_plaza_espana_sevilla',
				name: 'Plaza de España Sevilla',
				location_type: 'outdoor',
				address: 'Av. de Isabel la Católica',
				city: 'Sevilla',
				postal_code: '41004',
				region: 'Andalucía',
				department: 'Sevilla',
				country: 'Spain',
				country_code: 'ES',
				latitude: 37.3772,
				longitude: -5.9869,
				description: 'Place emblématique de Séville',
				foot_traffic: 'high',
				timezone: 'Europe/Madrid'
			}
		],
		screens: [
			{ id: 'screen:es_gran_via_1', location: 'location:es_gran_via', name: 'Gran Vía - Façade LED', screen_type: 'led', placement: 'outdoor', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 200, daily_impressions: 120000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 25 },
			{ id: 'screen:es_gran_via_2', location: 'location:es_gran_via', name: 'Gran Vía - Totem Digital', screen_type: 'led', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 75, daily_impressions: 80000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 18 },
			{ id: 'screen:es_rambla_1', location: 'location:es_la_rambla', name: 'La Rambla - Écran Principal', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 150, daily_impressions: 100000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 22 },
			{ id: 'screen:es_rambla_2', location: 'location:es_la_rambla', name: 'La Rambla - Panneau Sud', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 85000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 20 },
			{ id: 'screen:es_diagonal_1', location: 'location:es_cc_diagonal', name: 'L\'Illa Diagonal - Hall', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 75, daily_impressions: 45000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 15 },
			{ id: 'screen:es_diagonal_2', location: 'location:es_cc_diagonal', name: 'L\'Illa Diagonal - Entrée', screen_type: 'lcd', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 55, daily_impressions: 40000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:es_atocha_1', location: 'location:es_estacion_atocha', name: 'Atocha - Hall Principal', screen_type: 'led', placement: 'wall', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 90000, loop_duration_seconds: 90, slots_per_loop: 6, slot_duration_seconds: 15, price_per_slot: 20 },
			{ id: 'screen:es_sevilla_1', location: 'location:es_plaza_espana_sevilla', name: 'Plaza de España - LED', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 60000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
		]
	},
	BE: {
		locations: [
			{
				id: 'location:be_grand_place',
				name: 'Grand-Place Bruxelles',
				location_type: 'outdoor',
				address: 'Grand-Place 1',
				city: 'Bruxelles',
				postal_code: '1000',
				region: 'Bruxelles-Capitale',
				country: 'Belgium',
				country_code: 'BE',
				latitude: 50.8467,
				longitude: 4.3525,
				description: 'Place centrale historique de Bruxelles',
				foot_traffic: 'very_high',
				timezone: 'Europe/Brussels'
			},
			{
				id: 'location:be_gare_midi',
				name: 'Gare de Bruxelles-Midi',
				location_type: 'station',
				address: 'Avenue Fonsny 47B',
				city: 'Bruxelles',
				postal_code: '1060',
				region: 'Bruxelles-Capitale',
				country: 'Belgium',
				country_code: 'BE',
				latitude: 50.8357,
				longitude: 4.3366,
				description: 'Gare internationale Eurostar/Thalys',
				foot_traffic: 'very_high',
				timezone: 'Europe/Brussels'
			},
			{
				id: 'location:be_meir_anvers',
				name: 'Meir Antwerpen',
				location_type: 'outdoor',
				address: 'Meir 50',
				city: 'Antwerpen',
				postal_code: '2000',
				region: 'Flandre',
				department: 'Anvers',
				country: 'Belgium',
				country_code: 'BE',
				latitude: 51.2194,
				longitude: 4.4084,
				description: 'Rue commerçante principale d\'Anvers',
				foot_traffic: 'high',
				timezone: 'Europe/Brussels'
			},
			{
				id: 'location:be_cc_woluwe',
				name: 'Woluwe Shopping Center',
				location_type: 'mall',
				address: 'Boulevard de la Woluwe 2',
				city: 'Woluwe-Saint-Lambert',
				postal_code: '1200',
				region: 'Bruxelles-Capitale',
				country: 'Belgium',
				country_code: 'BE',
				latitude: 50.8460,
				longitude: 4.4310,
				description: 'Centre commercial majeur de Bruxelles',
				foot_traffic: 'high',
				timezone: 'Europe/Brussels'
			}
		],
		screens: [
			{ id: 'screen:be_grand_place_1', location: 'location:be_grand_place', name: 'Grand-Place - Écran LED', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 70000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 18 },
			{ id: 'screen:be_gare_midi_1', location: 'location:be_gare_midi', name: 'Bruxelles-Midi - Hall', screen_type: 'led', placement: 'wall', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 85000, loop_duration_seconds: 90, slots_per_loop: 6, slot_duration_seconds: 15, price_per_slot: 20 },
			{ id: 'screen:be_gare_midi_2', location: 'location:be_gare_midi', name: 'Bruxelles-Midi - Quai Eurostar', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 65, daily_impressions: 50000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
			{ id: 'screen:be_meir_1', location: 'location:be_meir_anvers', name: 'Meir - Panneau Digital', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 55000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
			{ id: 'screen:be_woluwe_1', location: 'location:be_cc_woluwe', name: 'Woluwe SC - Hall Central', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 75, daily_impressions: 40000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:be_woluwe_2', location: 'location:be_cc_woluwe', name: 'Woluwe SC - Entrée', screen_type: 'lcd', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 55, daily_impressions: 35000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 10 },
		]
	},
	CH: {
		locations: [
			{
				id: 'location:ch_bahnhofstrasse',
				name: 'Bahnhofstrasse Zürich',
				location_type: 'outdoor',
				address: 'Bahnhofstrasse 50',
				city: 'Zürich',
				postal_code: '8001',
				region: 'Zürich',
				country: 'Switzerland',
				country_code: 'CH',
				latitude: 47.3716,
				longitude: 8.5387,
				description: 'Avenue commerçante la plus prestigieuse de Suisse',
				foot_traffic: 'very_high',
				timezone: 'Europe/Zurich'
			},
			{
				id: 'location:ch_gare_geneve',
				name: 'Gare de Genève-Cornavin',
				location_type: 'station',
				address: 'Place de Cornavin',
				city: 'Genève',
				postal_code: '1201',
				region: 'Genève',
				country: 'Switzerland',
				country_code: 'CH',
				latitude: 46.2100,
				longitude: 6.1424,
				description: 'Gare principale de Genève',
				foot_traffic: 'very_high',
				timezone: 'Europe/Zurich'
			},
			{
				id: 'location:ch_westside_bern',
				name: 'Westside Bern',
				location_type: 'mall',
				address: 'Gilberte-de-Courgenay-Platz 4',
				city: 'Bern',
				postal_code: '3027',
				region: 'Bern',
				country: 'Switzerland',
				country_code: 'CH',
				latitude: 46.9404,
				longitude: 7.3904,
				description: 'Centre commercial et de loisirs de Berne',
				foot_traffic: 'high',
				timezone: 'Europe/Zurich'
			},
			{
				id: 'location:ch_flon_lausanne',
				name: 'Quartier du Flon Lausanne',
				location_type: 'outdoor',
				address: 'Place du Flon',
				city: 'Lausanne',
				postal_code: '1003',
				region: 'Vaud',
				country: 'Switzerland',
				country_code: 'CH',
				latitude: 46.5218,
				longitude: 6.6327,
				description: 'Quartier branché et animé de Lausanne',
				foot_traffic: 'high',
				timezone: 'Europe/Zurich'
			}
		],
		screens: [
			{ id: 'screen:ch_bahnhof_1', location: 'location:ch_bahnhofstrasse', name: 'Bahnhofstrasse - Grand LED', screen_type: 'led', placement: 'outdoor', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 150, daily_impressions: 90000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 30 },
			{ id: 'screen:ch_bahnhof_2', location: 'location:ch_bahnhofstrasse', name: 'Bahnhofstrasse - Totem', screen_type: 'led', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 65, daily_impressions: 70000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 22 },
			{ id: 'screen:ch_geneve_1', location: 'location:ch_gare_geneve', name: 'Cornavin - Hall Principal', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 85, daily_impressions: 65000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 20 },
			{ id: 'screen:ch_geneve_2', location: 'location:ch_gare_geneve', name: 'Cornavin - Quais', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 55, daily_impressions: 45000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
			{ id: 'screen:ch_westside_1', location: 'location:ch_westside_bern', name: 'Westside - Atrium', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 75, daily_impressions: 35000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 18 },
			{ id: 'screen:ch_flon_1', location: 'location:ch_flon_lausanne', name: 'Le Flon - Écran Place', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 40000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
		]
	},
	LU: {
		locations: [
			{
				id: 'location:lu_gare_centrale',
				name: 'Gare Centrale Luxembourg',
				location_type: 'station',
				address: 'Place de la Gare',
				city: 'Luxembourg',
				postal_code: '1616',
				region: 'Luxembourg',
				country: 'Luxembourg',
				country_code: 'LU',
				latitude: 49.5999,
				longitude: 6.1342,
				description: 'Gare principale de Luxembourg-Ville',
				foot_traffic: 'very_high',
				timezone: 'Europe/Luxembourg'
			},
			{
				id: 'location:lu_auchan_kirchberg',
				name: 'Auchan Kirchberg',
				location_type: 'mall',
				address: 'Plateau de Kirchberg',
				city: 'Luxembourg',
				postal_code: '1855',
				region: 'Luxembourg',
				country: 'Luxembourg',
				country_code: 'LU',
				latitude: 49.6283,
				longitude: 6.1579,
				description: 'Centre commercial au Kirchberg',
				foot_traffic: 'high',
				timezone: 'Europe/Luxembourg'
			},
			{
				id: 'location:lu_place_armes',
				name: 'Place d\'Armes',
				location_type: 'outdoor',
				address: 'Place d\'Armes',
				city: 'Luxembourg',
				postal_code: '1136',
				region: 'Luxembourg',
				country: 'Luxembourg',
				country_code: 'LU',
				latitude: 49.6113,
				longitude: 6.1296,
				description: 'Place centrale piétonne de Luxembourg-Ville',
				foot_traffic: 'high',
				timezone: 'Europe/Luxembourg'
			}
		],
		screens: [
			{ id: 'screen:lu_gare_1', location: 'location:lu_gare_centrale', name: 'Gare Luxembourg - Hall', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 85, daily_impressions: 50000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 18 },
			{ id: 'screen:lu_gare_2', location: 'location:lu_gare_centrale', name: 'Gare Luxembourg - Quais', screen_type: 'lcd', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 55, daily_impressions: 35000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
			{ id: 'screen:lu_auchan_1', location: 'location:lu_auchan_kirchberg', name: 'Auchan Kirchberg - Entrée', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 75, daily_impressions: 30000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:lu_place_armes_1', location: 'location:lu_place_armes', name: 'Place d\'Armes - Digital', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 25000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
		]
	},
	DE: {
		locations: [
			{
				id: 'location:de_alexanderplatz',
				name: 'Alexanderplatz Berlin',
				location_type: 'outdoor',
				address: 'Alexanderplatz',
				city: 'Berlin',
				postal_code: '10178',
				region: 'Berlin',
				country: 'Germany',
				country_code: 'DE',
				latitude: 52.5219,
				longitude: 13.4132,
				description: 'Place centrale et emblématique de Berlin',
				foot_traffic: 'very_high',
				timezone: 'Europe/Berlin'
			},
			{
				id: 'location:de_hbf_muenchen',
				name: 'München Hauptbahnhof',
				location_type: 'station',
				address: 'Bayerstraße 10A',
				city: 'München',
				postal_code: '80335',
				region: 'Bayern',
				department: 'Oberbayern',
				country: 'Germany',
				country_code: 'DE',
				latitude: 48.1402,
				longitude: 11.5600,
				description: 'Gare centrale de Munich',
				foot_traffic: 'very_high',
				timezone: 'Europe/Berlin'
			},
			{
				id: 'location:de_zeil_frankfurt',
				name: 'Zeil Frankfurt',
				location_type: 'outdoor',
				address: 'Zeil 112',
				city: 'Frankfurt am Main',
				postal_code: '60313',
				region: 'Hessen',
				country: 'Germany',
				country_code: 'DE',
				latitude: 50.1142,
				longitude: 8.6826,
				description: 'Rue commerçante la plus fréquentée d\'Allemagne',
				foot_traffic: 'very_high',
				timezone: 'Europe/Berlin'
			},
			{
				id: 'location:de_cc_europa',
				name: 'Europa-Center Berlin',
				location_type: 'mall',
				address: 'Tauentzienstraße 9',
				city: 'Berlin',
				postal_code: '10789',
				region: 'Berlin',
				country: 'Germany',
				country_code: 'DE',
				latitude: 52.5040,
				longitude: 13.3387,
				description: 'Centre commercial historique près du Kurfürstendamm',
				foot_traffic: 'high',
				timezone: 'Europe/Berlin'
			},
			{
				id: 'location:de_jungfernstieg',
				name: 'Jungfernstieg Hamburg',
				location_type: 'outdoor',
				address: 'Jungfernstieg',
				city: 'Hamburg',
				postal_code: '20354',
				region: 'Hamburg',
				country: 'Germany',
				country_code: 'DE',
				latitude: 53.5530,
				longitude: 9.9932,
				description: 'Promenade commerçante au bord de l\'Alster',
				foot_traffic: 'high',
				timezone: 'Europe/Berlin'
			}
		],
		screens: [
			{ id: 'screen:de_alex_1', location: 'location:de_alexanderplatz', name: 'Alexanderplatz - Grand LED', screen_type: 'led', placement: 'outdoor', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 200, daily_impressions: 150000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 28 },
			{ id: 'screen:de_alex_2', location: 'location:de_alexanderplatz', name: 'Alexanderplatz - Totem', screen_type: 'led', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 75, daily_impressions: 100000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 20 },
			{ id: 'screen:de_muenchen_1', location: 'location:de_hbf_muenchen', name: 'München Hbf - Hall', screen_type: 'led', placement: 'wall', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 95000, loop_duration_seconds: 90, slots_per_loop: 6, slot_duration_seconds: 15, price_per_slot: 22 },
			{ id: 'screen:de_muenchen_2', location: 'location:de_hbf_muenchen', name: 'München Hbf - Quais', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 65, daily_impressions: 60000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
			{ id: 'screen:de_zeil_1', location: 'location:de_zeil_frankfurt', name: 'Zeil - Panneau Digital', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 80000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 18 },
			{ id: 'screen:de_europa_1', location: 'location:de_cc_europa', name: 'Europa-Center - Atrium', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 75, daily_impressions: 45000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
			{ id: 'screen:de_hamburg_1', location: 'location:de_jungfernstieg', name: 'Jungfernstieg - Vitrine LED', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 55000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
		]
	},
	IT: {
		locations: [
			{
				id: 'location:it_duomo_milano',
				name: 'Piazza del Duomo Milano',
				location_type: 'outdoor',
				address: 'Piazza del Duomo',
				city: 'Milano',
				postal_code: '20122',
				region: 'Lombardia',
				department: 'Milano',
				country: 'Italy',
				country_code: 'IT',
				latitude: 45.4642,
				longitude: 9.1900,
				description: 'Place principale de Milan devant la cathédrale',
				foot_traffic: 'very_high',
				timezone: 'Europe/Rome'
			},
			{
				id: 'location:it_termini_roma',
				name: 'Roma Termini',
				location_type: 'station',
				address: 'Piazza dei Cinquecento',
				city: 'Roma',
				postal_code: '00185',
				region: 'Lazio',
				department: 'Roma',
				country: 'Italy',
				country_code: 'IT',
				latitude: 41.9009,
				longitude: 12.5016,
				description: 'Plus grande gare de Rome et d\'Italie',
				foot_traffic: 'very_high',
				timezone: 'Europe/Rome'
			},
			{
				id: 'location:it_galleria_milano',
				name: 'Galleria Vittorio Emanuele II',
				location_type: 'mall',
				address: 'Piazza del Duomo',
				city: 'Milano',
				postal_code: '20123',
				region: 'Lombardia',
				department: 'Milano',
				country: 'Italy',
				country_code: 'IT',
				latitude: 45.4659,
				longitude: 9.1903,
				description: 'Galerie commerciale historique de luxe',
				foot_traffic: 'very_high',
				timezone: 'Europe/Rome'
			},
			{
				id: 'location:it_via_toledo',
				name: 'Via Toledo Napoli',
				location_type: 'outdoor',
				address: 'Via Toledo',
				city: 'Napoli',
				postal_code: '80134',
				region: 'Campania',
				department: 'Napoli',
				country: 'Italy',
				country_code: 'IT',
				latitude: 40.8445,
				longitude: 14.2491,
				description: 'Rue commerçante historique de Naples',
				foot_traffic: 'high',
				timezone: 'Europe/Rome'
			},
			{
				id: 'location:it_ponte_vecchio_area',
				name: 'Piazza della Repubblica Firenze',
				location_type: 'outdoor',
				address: 'Piazza della Repubblica',
				city: 'Firenze',
				postal_code: '50123',
				region: 'Toscana',
				department: 'Firenze',
				country: 'Italy',
				country_code: 'IT',
				latitude: 43.7710,
				longitude: 11.2539,
				description: 'Place centrale historique de Florence',
				foot_traffic: 'high',
				timezone: 'Europe/Rome'
			}
		],
		screens: [
			{ id: 'screen:it_duomo_1', location: 'location:it_duomo_milano', name: 'Piazza Duomo - Grand Écran', screen_type: 'led', placement: 'outdoor', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 200, daily_impressions: 130000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 26 },
			{ id: 'screen:it_duomo_2', location: 'location:it_duomo_milano', name: 'Piazza Duomo - Totem', screen_type: 'led', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 75, daily_impressions: 90000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 20 },
			{ id: 'screen:it_termini_1', location: 'location:it_termini_roma', name: 'Roma Termini - Hall', screen_type: 'led', placement: 'wall', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 100000, loop_duration_seconds: 90, slots_per_loop: 6, slot_duration_seconds: 15, price_per_slot: 22 },
			{ id: 'screen:it_termini_2', location: 'location:it_termini_roma', name: 'Roma Termini - Quais', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 65, daily_impressions: 65000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
			{ id: 'screen:it_galleria_1', location: 'location:it_galleria_milano', name: 'Galleria V.E. II - Arcade', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 65, daily_impressions: 70000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 24 },
			{ id: 'screen:it_napoli_1', location: 'location:it_via_toledo', name: 'Via Toledo - Panneau LED', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 50000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
			{ id: 'screen:it_firenze_1', location: 'location:it_ponte_vecchio_area', name: 'Piazza Repubblica - Digital', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 45000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
		]
	},
	PT: {
		locations: [
			{
				id: 'location:pt_praca_comercio',
				name: 'Praça do Comércio Lisboa',
				location_type: 'outdoor',
				address: 'Praça do Comércio',
				city: 'Lisboa',
				postal_code: '1100-148',
				region: 'Lisboa',
				department: 'Lisboa',
				country: 'Portugal',
				country_code: 'PT',
				latitude: 38.7075,
				longitude: -9.1364,
				description: 'Place emblématique au bord du Tage',
				foot_traffic: 'very_high',
				timezone: 'Europe/Lisbon'
			},
			{
				id: 'location:pt_cc_colombo',
				name: 'Centro Colombo',
				location_type: 'mall',
				address: 'Av. Lusíada',
				city: 'Lisboa',
				postal_code: '1500-392',
				region: 'Lisboa',
				department: 'Lisboa',
				country: 'Portugal',
				country_code: 'PT',
				latitude: 38.7536,
				longitude: -9.1883,
				description: 'Plus grand centre commercial du Portugal',
				foot_traffic: 'very_high',
				timezone: 'Europe/Lisbon'
			},
			{
				id: 'location:pt_aliados_porto',
				name: 'Avenida dos Aliados Porto',
				location_type: 'outdoor',
				address: 'Av. dos Aliados',
				city: 'Porto',
				postal_code: '4000-064',
				region: 'Porto',
				department: 'Porto',
				country: 'Portugal',
				country_code: 'PT',
				latitude: 41.1496,
				longitude: -8.6110,
				description: 'Avenue principale du centre de Porto',
				foot_traffic: 'high',
				timezone: 'Europe/Lisbon'
			},
			{
				id: 'location:pt_estacao_oriente',
				name: 'Estação do Oriente',
				location_type: 'station',
				address: 'Av. Dom João II',
				city: 'Lisboa',
				postal_code: '1990-095',
				region: 'Lisboa',
				department: 'Lisboa',
				country: 'Portugal',
				country_code: 'PT',
				latitude: 38.7681,
				longitude: -9.0992,
				description: 'Gare moderne de Calatrava à Lisbonne',
				foot_traffic: 'high',
				timezone: 'Europe/Lisbon'
			}
		],
		screens: [
			{ id: 'screen:pt_comercio_1', location: 'location:pt_praca_comercio', name: 'Praça Comércio - Grand LED', screen_type: 'led', placement: 'outdoor', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 150, daily_impressions: 80000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 18 },
			{ id: 'screen:pt_comercio_2', location: 'location:pt_praca_comercio', name: 'Praça Comércio - Totem', screen_type: 'led', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 65, daily_impressions: 60000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
			{ id: 'screen:pt_colombo_1', location: 'location:pt_cc_colombo', name: 'Centro Colombo - Atrium', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 85, daily_impressions: 70000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
			{ id: 'screen:pt_colombo_2', location: 'location:pt_cc_colombo', name: 'Centro Colombo - Entrée', screen_type: 'lcd', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 55, daily_impressions: 50000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:pt_aliados_1', location: 'location:pt_aliados_porto', name: 'Aliados Porto - Panneau', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 40000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:pt_oriente_1', location: 'location:pt_estacao_oriente', name: 'Oriente - Hall Principal', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 75, daily_impressions: 45000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
		]
	},
	GB: {
		locations: [
			{
				id: 'location:gb_piccadilly',
				name: 'Piccadilly Circus London',
				location_type: 'outdoor',
				address: 'Piccadilly Circus',
				city: 'London',
				postal_code: 'W1J 9HP',
				region: 'England',
				department: 'Greater London',
				country: 'United Kingdom',
				country_code: 'GB',
				latitude: 51.5099,
				longitude: -0.1342,
				description: 'Carrefour emblématique de Londres avec écrans géants',
				foot_traffic: 'very_high',
				timezone: 'Europe/London'
			},
			{
				id: 'location:gb_kings_cross',
				name: 'King\'s Cross Station',
				location_type: 'station',
				address: 'Euston Road',
				city: 'London',
				postal_code: 'N1C 4QP',
				region: 'England',
				department: 'Greater London',
				country: 'United Kingdom',
				country_code: 'GB',
				latitude: 51.5308,
				longitude: -0.1238,
				description: 'Grande gare londonienne, hub Eurostar',
				foot_traffic: 'very_high',
				timezone: 'Europe/London'
			},
			{
				id: 'location:gb_bullring',
				name: 'Bullring Birmingham',
				location_type: 'mall',
				address: 'Bullring',
				city: 'Birmingham',
				postal_code: 'B5 4BU',
				region: 'England',
				department: 'West Midlands',
				country: 'United Kingdom',
				country_code: 'GB',
				latitude: 52.4775,
				longitude: -1.8936,
				description: 'Centre commercial majeur de Birmingham',
				foot_traffic: 'high',
				timezone: 'Europe/London'
			},
			{
				id: 'location:gb_buchanan_glasgow',
				name: 'Buchanan Street Glasgow',
				location_type: 'outdoor',
				address: 'Buchanan Street',
				city: 'Glasgow',
				postal_code: 'G1 2FF',
				region: 'Scotland',
				department: 'Glasgow',
				country: 'United Kingdom',
				country_code: 'GB',
				latitude: 55.8612,
				longitude: -4.2517,
				description: 'Rue commerçante piétonne principale de Glasgow',
				foot_traffic: 'high',
				timezone: 'Europe/London'
			},
			{
				id: 'location:gb_deansgate_manchester',
				name: 'Deansgate Manchester',
				location_type: 'outdoor',
				address: 'Deansgate',
				city: 'Manchester',
				postal_code: 'M3 4LQ',
				region: 'England',
				department: 'Greater Manchester',
				country: 'United Kingdom',
				country_code: 'GB',
				latitude: 53.4786,
				longitude: -2.2485,
				description: 'Artère commerçante du centre de Manchester',
				foot_traffic: 'high',
				timezone: 'Europe/London'
			}
		],
		screens: [
			{ id: 'screen:gb_piccadilly_1', location: 'location:gb_piccadilly', name: 'Piccadilly - Grand LED', screen_type: 'led', placement: 'outdoor', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 300, daily_impressions: 200000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 35 },
			{ id: 'screen:gb_piccadilly_2', location: 'location:gb_piccadilly', name: 'Piccadilly - Panel B', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 150, daily_impressions: 150000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 28 },
			{ id: 'screen:gb_kings_cross_1', location: 'location:gb_kings_cross', name: 'King\'s Cross - Main Hall', screen_type: 'led', placement: 'wall', resolution: '3840x2160', width_px: 3840, height_px: 2160, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 120, daily_impressions: 90000, loop_duration_seconds: 90, slots_per_loop: 6, slot_duration_seconds: 15, price_per_slot: 22 },
			{ id: 'screen:gb_kings_cross_2', location: 'location:gb_kings_cross', name: 'King\'s Cross - Platform', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 65, daily_impressions: 60000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 16 },
			{ id: 'screen:gb_bullring_1', location: 'location:gb_bullring', name: 'Bullring - Central Atrium', screen_type: 'lcd', placement: 'wall', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 85, daily_impressions: 50000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
			{ id: 'screen:gb_bullring_2', location: 'location:gb_bullring', name: 'Bullring - Entrance', screen_type: 'lcd', placement: 'totem', resolution: '1080x1920', width_px: 1080, height_px: 1920, orientation: 'portrait', aspect_ratio: '9:16', size_inches: 55, daily_impressions: 40000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:gb_glasgow_1', location: 'location:gb_buchanan_glasgow', name: 'Buchanan St - Digital Panel', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 35000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 12 },
			{ id: 'screen:gb_manchester_1', location: 'location:gb_deansgate_manchester', name: 'Deansgate - LED Screen', screen_type: 'led', placement: 'outdoor', resolution: '1920x1080', width_px: 1920, height_px: 1080, orientation: 'landscape', aspect_ratio: '16:9', size_inches: 100, daily_impressions: 40000, loop_duration_seconds: 60, slots_per_loop: 4, slot_duration_seconds: 15, price_per_slot: 14 },
		]
	}
};

async function seedInternationalScreens() {
	console.log('🌍 Ajout d\'écrans internationaux dans tous les pays...\n');
	
	const db = new Surreal();
	
	try {
		await db.connect(`${SURREAL_URL}/rpc`);
		await db.signin({ username: SURREAL_USER, password: SURREAL_PASS });
		await db.use({ namespace: SURREAL_NAMESPACE, database: SURREAL_DATABASE });
		console.log('✅ Connecté à SurrealDB\n');

		// ============================================
		// 1. Mettre à jour les pays avec name_fr, name_en, center_lat, center_lng, default_zoom
		// ============================================
		console.log('🏳️ Mise à jour des pays avec coordonnées et noms traduits...');
		
		for (const [code, data] of Object.entries(countryUpdates)) {
			try {
				await db.query(`
					UPDATE country:${code} SET 
						name_fr = $name_fr,
						name_en = $name_en,
						center_lat = $center_lat,
						center_lng = $center_lng,
						default_zoom = $default_zoom,
						is_active = true,
						updated_at = time::now()
				`, data);
				console.log(`   ✓ ${data.name_fr} (${code}) mis à jour`);
			} catch (e: any) {
				console.log(`   ⚠ ${code}: ${e.message}`);
			}
		}

		// ============================================
		// 2. Vérifier le provider par défaut
		// ============================================
		console.log('\n📦 Vérification des prestataires...');
		const providers = await db.query<[any[]]>('SELECT id FROM provider WHERE is_active = true LIMIT 1');
		const defaultProvider = providers[0]?.[0]?.id;
		
		if (!defaultProvider) {
			console.log('   ⚠ Aucun prestataire actif trouvé, création d\'un prestataire international...');
			await db.query(`CREATE provider:international CONTENT {
				name: 'NeoAd International',
				legal_name: 'NeoAd International SAS',
				country: 'France',
				contact_email: 'international@neoad.io',
				commission_rate: 0.15,
				is_active: true,
				created_at: time::now(),
				updated_at: time::now()
			}`);
		}
		
		const providerIdStr = defaultProvider ? String(defaultProvider) : 'provider:international';
		console.log(`   ✓ Provider par défaut: ${providerIdStr}`);

		// ============================================
		// 3. Créer les locations et écrans pour chaque pays
		// ============================================
		let totalLocations = 0;
		let totalScreens = 0;

		for (const [countryCode, data] of Object.entries(internationalData)) {
			const countryName = countryUpdates[countryCode]?.name_fr || countryCode;
			console.log(`\n🌐 ${countryName} (${countryCode})...`);
			
			// Vérifier si le pays a déjà des écrans
			const existingScreens = await db.query<[any[]]>(
				`SELECT count() as cnt FROM screen WHERE location.country_code = $code GROUP ALL`,
				{ code: countryCode }
			);
			const existingCount = existingScreens[0]?.[0]?.cnt || 0;
			
			if (existingCount > 0) {
				console.log(`   ℹ ${existingCount} écrans existent déjà, ajout des nouveaux seulement...`);
			}

			// Créer les locations
			let locCreated = 0;
			for (const loc of data.locations) {
				try {
					const deptClause = loc.department ? `department: "${loc.department.replace(/"/g, '\\"')}",` : '';
					
					await db.query(`CREATE ${loc.id} CONTENT {
						name: "${loc.name.replace(/"/g, '\\"')}",
						location_type: "${loc.location_type}",
						address: "${loc.address.replace(/"/g, '\\"')}",
						city: "${loc.city}",
						postal_code: "${loc.postal_code}",
						region: "${loc.region}",
						${deptClause}
						country: "${loc.country}",
						country_code: "${loc.country_code}",
						latitude: ${loc.latitude},
						longitude: ${loc.longitude},
						description: "${loc.description.replace(/"/g, '\\"')}",
						foot_traffic: "${loc.foot_traffic}",
						timezone: "${loc.timezone}",
						provider: ${providerIdStr},
						photos: [],
						amenities: [],
						is_active: true,
						is_public: true,
						created_at: time::now(),
						updated_at: time::now()
					}`);
					locCreated++;
				} catch (e: any) {
					if (e.message?.includes('already exists') || e.message?.includes('Database record')) {
						console.log(`   ⋅ Location ${loc.name} existe déjà`);
					} else {
						console.log(`   ⚠ Location ${loc.name}: ${e.message}`);
					}
				}
			}
			console.log(`   📍 ${locCreated}/${data.locations.length} locations créées`);
			totalLocations += locCreated;

			// Créer les écrans
			let scrCreated = 0;
			for (const scr of data.screens) {
				try {
					// Derive v1 'type' from placement
					const screenType = scr.placement === 'outdoor' ? 'outdoor' : 'indoor';
					
					await db.query(`CREATE ${scr.id} CONTENT {
						name: "${scr.name.replace(/"/g, '\\"')}",
						location: ${scr.location},
						type: "${screenType}",
						screen_type: "${scr.screen_type}",
						placement: "${scr.placement}",
						resolution: "${scr.resolution}",
						width_px: ${scr.width_px},
						height_px: ${scr.height_px},
						orientation: "${scr.orientation}",
						aspect_ratio: "${scr.aspect_ratio}",
						size_inches: ${scr.size_inches}.0,
						daily_impressions: ${scr.daily_impressions},
						loop_duration_seconds: ${scr.loop_duration_seconds},
						slots_per_loop: ${scr.slots_per_loop},
						slot_duration_seconds: ${scr.slot_duration_seconds},
						price_per_slot: ${scr.price_per_slot}.0,
						is_active: true,
						is_online: true,
						supported_formats: ['image/jpeg', 'image/png', 'video/mp4'],
						max_file_size_mb: 100,
						photos: [],
						created_at: time::now(),
						updated_at: time::now()
					}`);
					scrCreated++;
				} catch (e: any) {
					if (e.message?.includes('already exists') || e.message?.includes('Database record')) {
						console.log(`   ⋅ Screen ${scr.name} existe déjà`);
					} else {
						console.log(`   ⚠ Screen ${scr.name}: ${e.message}`);
					}
				}
			}
			console.log(`   🖥️ ${scrCreated}/${data.screens.length} écrans créés`);
			totalScreens += scrCreated;
		}

		// ============================================
		// 5. Résumé
		// ============================================
		console.log('\n' + '═'.repeat(55));
		console.log('✅ Seed international terminé !');
		console.log('═'.repeat(55));
		
		// Compter les écrans par pays
		console.log('\n📊 Récapitulatif des écrans par pays:');
		for (const [code, info] of Object.entries(countryUpdates)) {
			const countResult = await db.query<[any[]]>(
				`SELECT count() as cnt FROM screen WHERE location.country_code = $code GROUP ALL`,
				{ code }
			);
			const cnt = countResult[0]?.[0]?.cnt || 0;
			console.log(`   ${code} ${info.name_fr}: ${cnt} écrans`);
		}
		
		console.log(`\n   📍 ${totalLocations} nouvelles locations créées`);
		console.log(`   🖥️ ${totalScreens} nouveaux écrans créés`);

	} catch (error) {
		console.error('❌ Erreur:', error);
		process.exit(1);
	} finally {
		await db.close();
	}
}

seedInternationalScreens();
