-- MSIN-4443 — Assignation globale sans séquence existante
-- Idempotent. Exécuter après déploiement PHP/JS.

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_existing_title', 'fr', 'Assignation des dossards avec séquences existantes', 'Utilise les séquences déjà configurées pour chaque épreuve solo.', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_existing_title' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_existing_title', 'en', 'Bib assignment with existing sequences', 'Uses sequences already configured for each solo race.', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_existing_title' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_generated_title', 'fr', 'Assignation de dossards sans séquence existante', 'Crée automatiquement une plage par épreuve, à la taille des inscriptions à assigner.', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_generated_title' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_generated_title', 'en', 'Bib assignment without existing sequences', 'Automatically creates one range per race, sized to registrations to assign.', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_generated_title' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_start_bib', 'fr', 'Dossard numéro 1', 'Premier numéro de la plage globale. Les plages créées se suivent dans l''ordre des épreuves (epr_id).', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_start_bib' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_start_bib', 'en', 'First bib number', 'First number of the global range. Created ranges continue in race order (epr_id).', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_start_bib' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_hint', 'fr', 'Épreuves solo sans séquence : une plage est créée pour chaque épreuve sélectionnée, à la taille exacte des inscriptions à assigner. Les numéros se suivent dans l''ordre des épreuves.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_hint' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_hint', 'en', 'Solo races without sequences: one range is created per selected race, sized exactly to registrations to assign. Bib numbers continue in race order.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_hint' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_range_preview', 'fr', 'Plage prévue : %d → %d · %d à assigner', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_range_preview' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_range_preview', 'en', 'Planned range: %d → %d · %d to assign', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_range_preview' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_plan_invalid', 'fr', 'Sélection invalide : dossard de départ et au moins une épreuve avec inscriptions à assigner.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_plan_invalid' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_plan_invalid', 'en', 'Invalid selection: starting bib and at least one race with registrations to assign.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_plan_invalid' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_no_pending', 'fr', 'Aucune inscription à assigner dans les épreuves sélectionnées.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_no_pending' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_no_pending', 'en', 'No registrations to assign in the selected races.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_no_pending' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_has_seq', 'fr', 'Une épreuve sélectionnée a déjà une séquence — rechargez le panneau.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_has_seq' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_has_seq', 'en', 'A selected race already has a sequence — reload the panel.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_has_seq' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_no_start', 'fr', 'Indiquez le numéro du premier dossard.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_no_start' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_gen_no_start', 'en', 'Enter the first bib number.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_gen_no_start' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_unavailable', 'fr', 'Aucune assignation globale disponible pour cet événement.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_unavailable' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_unavailable', 'en', 'No global assignment available for this event.', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_unavailable' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_ajax_global_gen_sim_summary', 'fr', '%d épreuve(s) · %d dossards · %d à assigner', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_ajax_global_gen_sim_summary' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_ajax_global_gen_sim_summary', 'en', '%d race(s) · %d bibs · %d to assign', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_ajax_global_gen_sim_summary' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_ajax_global_gen_analysis', 'fr', '%d épreuve(s) · plage %d → %d · %d à assigner', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_ajax_global_gen_analysis' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_ajax_global_gen_analysis', 'en', '%d race(s) · range %d → %d · %d to assign', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_ajax_global_gen_analysis' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_js_global_batch_finalizing', 'fr', 'Finalisation — mise à jour de l''affichage…', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_js_global_batch_finalizing' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_js_global_batch_finalizing', 'en', 'Finishing — refreshing the display…', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_js_global_batch_finalizing' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_go_complete_title', 'fr', 'Assignation terminée', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_go_complete_title' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_go_complete_title', 'en', 'Assignment complete', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_go_complete_title' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_go_complete_summary', 'fr', '%d dossard(s) assigné(s) sur %d · %d épreuve(s)', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_go_complete_summary' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_go_complete_summary', 'en', '%d bib(s) assigned of %d · %d race(s)', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_go_complete_summary' AND info_langue = 'en' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_go_complete_reload', 'fr', 'OK — Recharger la page', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_go_complete_reload' AND info_langue = 'fr' AND info_prg = 'compte.php');

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_global_batch_go_complete_reload', 'en', 'OK — Reload page', '', 'compte.php', '', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_global_batch_go_complete_reload' AND info_langue = 'en' AND info_prg = 'compte.php');
