SET NAMES utf8mb4;
SET CHARACTER SET utf8mb4;

INSERT INTO users (name, email, password_hash, role) VALUES
('Admin Volley', 'admin@volley.test', '$2y$10$ECgUnurZ4VOapbKn08r7t.3iYYfu5EjqgZHev.SfcbwzDrvVwiW56', 'admin'),
('Delegado Norte', 'delegado@volley.test', '$2y$10$ECgUnurZ4VOapbKn08r7t.3iYYfu5EjqgZHev.SfcbwzDrvVwiW56', 'delegate');

INSERT INTO tournaments (name, category, age_subcategory, format, status, starts_at)
VALUES ('Liga Apertura Metropolitana', 'Mixto', 'Libre', 'Liga', 'active', CURDATE());

INSERT INTO courts (name, address) VALUES
('Cancha Central', 'Polideportivo Municipal'),
('Cancha Norte', 'Club Barrio Norte');

INSERT INTO referees (name, license, phone) VALUES
('Laura Medina', 'ARB-001', '+54 11 5555-0101'),
('Carlos Rivas', 'ARB-002', '+54 11 5555-0102');

INSERT INTO teams (tournament_id, name, coach_name, delegate_user_id, registration_token) VALUES
(1, 'Condores VC', 'Marta Salas', 2, '11111111111111111111111111111111'),
(1, 'Titanes Sur', 'Julian Paz', NULL, '22222222222222222222222222222222'),
(1, 'Central Volley', 'Noelia Torres', NULL, '33333333333333333333333333333333'),
(1, 'Atletico Red', 'Ramiro Lopez', NULL, '44444444444444444444444444444444');

INSERT INTO players (team_id, first_name, last_name, document_id, birth_date, jersey_number, position) VALUES
(1, 'Sofia', 'Arias', '301', '1998-04-10', 7, 'Punta'),
(1, 'Mateo', 'Benitez', '302', '1996-09-17', 11, 'Armador'),
(2, 'Lucia', 'Campos', '401', '1999-01-20', 4, 'Libero'),
(2, 'Tomas', 'Diaz', '402', '1995-06-02', 9, 'Opuesto'),
(3, 'Paula', 'Funes', '501', '2000-11-01', 6, 'Central'),
(3, 'Bruno', 'Gomez', '502', '1997-03-13', 12, 'Punta'),
(4, 'Camila', 'Herrera', '601', '1998-12-22', 3, 'Armador'),
(4, 'Nicolas', 'Ibarra', '602', '1994-05-09', 14, 'Central');

INSERT INTO matches (tournament_id, phase, scheduled_at, court_id, home_team_id, away_team_id, status)
VALUES
(1, 'regular', DATE_ADD(NOW(), INTERVAL 1 DAY), 1, 1, 2, 'scheduled'),
(1, 'regular', DATE_ADD(NOW(), INTERVAL 2 DAY), 2, 3, 4, 'scheduled');

INSERT INTO team_standings (tournament_id, team_id) VALUES (1,1), (1,2), (1,3), (1,4);
