INSERT INTO role (name) VALUES ('ROLE_ADMIN'), ('ROLE_USER') ON CONFLICT (name) DO NOTHING;

-- Password is "Talange2026!" hashed with Argon2id
INSERT INTO app_user (username, password, enabled) VALUES ('Ucef', '$argon2id$v=19$m=65536,t=3,p=4$q29E/VM1esZVxo9HufgILQ$Nzb+rwwsZUMy04BbewYum2A8L8ujs9VZj9VJ/609Am0', true)
ON CONFLICT (username) DO NOTHING;

INSERT INTO user_role (user_id, role_id) VALUES ((SELECT id FROM app_user WHERE username = 'Ucef'), (SELECT id FROM role WHERE name = 'ROLE_ADMIN'))
ON CONFLICT (user_id, role_id) DO NOTHING;

INSERT INTO categorie (nom, annee_min, annee_max, tarif_base) VALUES 
('U6', 2020, 2020, 100.00),
('U7', 2019, 2019, 100.00),
('U8', 2018, 2018, 120.00),
('U9', 2017, 2017, 120.00),
('U10', 2016, 2016, 130.00),
('U11', 2015, 2015, 130.00),
('U12', 2014, 2014, 140.00),
('U13', 2013, 2013, 140.00),
('Senior', 1900, 2005, 180.00)
ON CONFLICT (nom) DO NOTHING;

INSERT INTO equipement (nom, obligatoire)
SELECT 'Maillot', true WHERE NOT EXISTS (SELECT 1 FROM equipement WHERE nom = 'Maillot');
INSERT INTO equipement (nom, obligatoire)
SELECT 'Short', true WHERE NOT EXISTS (SELECT 1 FROM equipement WHERE nom = 'Short');
INSERT INTO equipement (nom, obligatoire)
SELECT 'Chaussettes', true WHERE NOT EXISTS (SELECT 1 FROM equipement WHERE nom = 'Chaussettes');
INSERT INTO equipement (nom, obligatoire)
SELECT 'Survêtement', false WHERE NOT EXISTS (SELECT 1 FROM equipement WHERE nom = 'Survêtement');
