-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 17, 2025 at 04:08 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `freestyle_db`
--

-- --------------------------------------------------------

--
-- Table structure for table `bib_assignments`
--

CREATE TABLE `bib_assignments` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `participant_id` int(11) NOT NULL,
  `bib_number` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `bib_series`
--

CREATE TABLE `bib_series` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `color` varchar(20) DEFAULT NULL,
  `start_number` int(11) NOT NULL,
  `end_number` int(11) NOT NULL,
  `missing_numbers` text DEFAULT NULL,
  `additional_numbers` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `bib_series`
--

INSERT INTO `bib_series` (`id`, `event_id`, `name`, `color`, `start_number`, `end_number`, `missing_numbers`, `additional_numbers`, `created_at`) VALUES
(1, 3, 'Niebieskie', '#007BFF', 1, 150, '100', '155', '2025-07-27 09:48:19'),
(8, 3, 'Sprzęt DJ ski', '#28A745', 160, 250, '', '', '2025-07-27 10:02:29'),
(13, 4, 'Sprzęt DJ ski', '#003366', 1, 500, '', '', '2025-07-28 00:44:11'),
(14, 3, 'Miksery', '#DC3545', 251, 350, '', '', '2025-07-28 12:00:39');

-- --------------------------------------------------------

--
-- Table structure for table `budgets`
--

CREATE TABLE `budgets` (
  `id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `balance` decimal(10,2) DEFAULT 0.00,
  `total_purchased` decimal(10,2) DEFAULT 0.00,
  `total_spent` decimal(10,2) DEFAULT 0.00,
  `currency` varchar(3) DEFAULT 'USD',
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `budgets`
--

INSERT INTO `budgets` (`id`, `group_id`, `balance`, `total_purchased`, `total_spent`, `currency`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 1, 100.00, 100.00, 0.00, 'USD', 1, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(2, 2, 100.00, 100.00, 0.00, 'USD', 1, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(3, 3, 100.00, 100.00, 0.00, 'USD', 1, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(4, 4, 100.00, 100.00, 0.00, 'USD', 1, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(5, 5, 100.00, 100.00, 0.00, 'USD', 1, '2025-08-16 02:01:42', '2025-08-16 02:01:42');

-- --------------------------------------------------------

--
-- Table structure for table `events`
--

CREATE TABLE `events` (
  `id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `scoring_mode` enum('average','best','total') DEFAULT 'average',
  `scoring_format` varchar(50) NOT NULL,
  `runs_per_heat` int(11) DEFAULT 2,
  `heats_total` int(11) DEFAULT 1,
  `sport_discipline` varchar(100) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `max_participants` int(11) DEFAULT NULL,
  `age_limit` varchar(50) NOT NULL DEFAULT 'None',
  `entry_fee` decimal(10,2) DEFAULT NULL,
  `contact_email` varchar(255) DEFAULT NULL,
  `contact_phone` varchar(50) DEFAULT NULL,
  `registration_deadline` date DEFAULT NULL,
  `status` enum('draft','open','closed','completed','live') DEFAULT 'open',
  `owner_group_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `events`
--

INSERT INTO `events` (`id`, `name`, `date`, `location`, `scoring_mode`, `scoring_format`, `runs_per_heat`, `heats_total`, `sport_discipline`, `description`, `max_participants`, `age_limit`, `entry_fee`, `contact_email`, `contact_phone`, `registration_deadline`, `status`, `owner_group_id`) VALUES
(3, 'Hocki Klocki', '2025-07-28', 'Kraków', 'best', 'snowboard_big_air_best_two', 3, 2, 'snowboard', '', 0, 'None', 0.00, '', '', '0000-00-00', 'live', NULL),
(4, 'Puchar Osiałka', '2025-09-30', 'Kraków', 'best', 'freeski_big_air_best_two', 3, 2, 'freeski', '', 50, 'None', 0.00, '', '', '2025-07-29', 'draft', NULL),
(5, 'septy', '2025-08-22', 'Kraków', 'best', 'snowboard_slopestyle_sections_oi', 2, 2, 'snowboard', '', 0, 'None', 0.00, '', '', '0000-00-00', 'draft', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `event_categories`
--

CREATE TABLE `event_categories` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `category_name` varchar(100) NOT NULL,
  `start_year` int(11) DEFAULT NULL,
  `end_year` int(11) DEFAULT NULL,
  `gender` enum('M','F','open') DEFAULT 'open',
  `requires_fis_number` tinyint(1) DEFAULT 0,
  `requires_licence_number` tinyint(1) DEFAULT 0,
  `is_main_category` tinyint(1) DEFAULT 0,
  `use_for_ranking` tinyint(1) DEFAULT 0,
  `country_rule` enum('all','include','exclude') DEFAULT 'all',
  `country_codes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`country_codes`)),
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `event_categories`
--

INSERT INTO `event_categories` (`id`, `event_id`, `category_name`, `start_year`, `end_year`, `gender`, `requires_fis_number`, `requires_licence_number`, `is_main_category`, `use_for_ranking`, `country_rule`, `country_codes`, `created_at`, `updated_at`) VALUES
(1, 3, 'testowa - senior men', 1983, 2005, 'M', 0, 0, 1, 1, 'all', '[]', '2025-08-06 16:48:00', '2025-08-08 09:20:43'),
(3, 3, 'testowa - senior female', 1983, 2005, 'F', 0, 0, 1, 1, 'all', '[]', '2025-08-06 16:52:33', '2025-08-08 09:20:35'),
(9, 3, 'Chłopcy junor', 2006, NULL, 'M', 0, 0, 1, 1, 'all', '[]', '2025-08-06 17:56:59', '2025-08-10 23:36:38'),
(10, 3, 'Dziewczynki junior', 2006, NULL, 'F', 0, 0, 1, 1, 'all', '[]', '2025-08-06 17:57:15', '2025-08-10 23:32:26'),
(11, 3, 'Dziewczynki FIS', NULL, NULL, 'F', 1, 0, 0, 1, 'all', '[]', '2025-08-11 09:43:33', '2025-08-11 09:43:33');

-- --------------------------------------------------------

--
-- Table structure for table `event_control_points`
--

CREATE TABLE `event_control_points` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `control_point_name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `sort_order` int(11) DEFAULT 0,
  `is_active` tinyint(1) DEFAULT 1,
  `weight` varchar(250) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `event_control_points`
--

INSERT INTO `event_control_points` (`id`, `event_id`, `control_point_name`, `description`, `sort_order`, `is_active`, `weight`, `status`, `created_at`, `updated_at`) VALUES
(1, 3, 'Jump 1', '', 1, 1, '1.0', 1, '2025-08-06 15:22:24', '2025-08-15 02:25:07'),
(2, 3, 'Bula pierwsza', '', 2, 1, '0.8', 1, '2025-08-06 15:24:01', '2025-08-15 02:25:12');

-- --------------------------------------------------------

--
-- Table structure for table `event_heat_settings`
--

CREATE TABLE `event_heat_settings` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `heat_number` int(11) NOT NULL,
  `heat_name` varchar(255) DEFAULT NULL,
  `scoring_type` enum('Points','Time','Style') DEFAULT 'Points',
  `runs_count` int(11) DEFAULT 1,
  `runs_scoring_method` varchar(50) DEFAULT 'best_from_all',
  `time_start` time DEFAULT NULL,
  `estimate_time_per_participant` int(11) DEFAULT 0,
  `categories` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`categories`)),
  `flow_type` enum('none','promotion','qualifying') NOT NULL DEFAULT 'none',
  `flow_source_heat` int(11) DEFAULT NULL,
  `flow_participants_per_category` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) DEFAULT 0,
  `active_run` int(11) DEFAULT 1,
  `bib_on_start` int(11) DEFAULT NULL,
  `bib_latest_on_run` int(11) DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `format_name` varchar(255) DEFAULT NULL COMMENT 'Heat-specific format name override',
  `discipline` varchar(100) DEFAULT NULL COMMENT 'Sport discipline for this heat',
  `difficulty_level` varchar(50) DEFAULT NULL COMMENT 'Difficulty level',
  `course_length` int(11) DEFAULT 0 COMMENT 'Course length in meters',
  `time_limit` int(11) DEFAULT 0 COMMENT 'Time limit per run in seconds',
  `weather_dependent` tinyint(1) DEFAULT 0 COMMENT 'Whether heat is weather dependent',
  `format_description` text DEFAULT NULL COMMENT 'Detailed format description',
  `scoring_method` varchar(100) DEFAULT 'standard' COMMENT 'Scoring method',
  `required_figures` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'JSON array of required figures' CHECK (json_valid(`required_figures`)),
  `judges_required` int(11) DEFAULT 5 COMMENT 'Number of judges required',
  `scale_min` decimal(5,2) DEFAULT 0.00 COMMENT 'Minimum score value',
  `scale_max` decimal(5,2) DEFAULT 100.00 COMMENT 'Maximum score value',
  `precision_decimal` int(11) DEFAULT 0 COMMENT 'Number of decimal places for scores'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `event_heat_settings`
--

INSERT INTO `event_heat_settings` (`id`, `event_id`, `heat_number`, `heat_name`, `scoring_type`, `runs_count`, `runs_scoring_method`, `time_start`, `estimate_time_per_participant`, `categories`, `flow_type`, `flow_source_heat`, `flow_participants_per_category`, `is_active`, `active_run`, `bib_on_start`, `bib_latest_on_run`, `updated_at`, `created_at`, `format_name`, `discipline`, `difficulty_level`, `course_length`, `time_limit`, `weather_dependent`, `format_description`, `scoring_method`, `required_figures`, `judges_required`, `scale_min`, `scale_max`, `precision_decimal`) VALUES
(112, 4, 1, 'Kwalifikacje 1', 'Points', 1, 'best_from_all', NULL, 0, NULL, 'none', NULL, 0, 0, 1, NULL, NULL, '2025-08-15 13:14:17', '2025-08-08 12:02:40', 'Freeski – Big Air (Best 2)', 'freeski', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(113, 4, 2, 'Półfinał 1', 'Points', 1, 'best_from_all', NULL, 0, NULL, 'none', NULL, 0, 0, 1, NULL, NULL, '2025-08-15 13:14:17', '2025-08-08 12:02:40', 'Freeski – Big Air (Best 2)', 'freeski', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(114, 3, 1, 'Kwalifikacje - Junior', 'Points', 3, 'best_from_3', '04:00:00', 125, '[\"9\",\"10\"]', 'none', NULL, 0, 1, 1, NULL, NULL, '2025-08-16 20:57:23', '2025-08-08 12:02:40', 'Snowboard – Big Air (Best 2)', '', '', 0, 0, 0, '', 'standard', '\"\"', 5, 0.00, 100.00, 0),
(115, 3, 2, 'Finał - Junior', 'Points', 2, 'best_from_all', '05:50:00', 80, '[\"9\",\"10\"]', 'promotion', 1, 8, 0, 1, NULL, 7, '2025-08-15 21:07:30', '2025-08-08 12:02:40', 'Snowboard – Big Air (Best 2)', 'snowboard', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(116, 3, 3, 'Kwalifikacje - senior 2', 'Points', 2, 'best_from_2', '06:00:00', 0, '[\"3\",\"1\"]', 'none', NULL, 0, 0, 0, NULL, NULL, '2025-08-15 21:07:30', '2025-08-08 12:02:40', 'Snowboard – Big Air (Best 2)', 'snowboard', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(120, 3, 4, 'Finał - Senior', 'Points', 3, 'best_from_3', '07:00:00', 0, '[\"3\",\"1\"]', 'promotion', 3, 25, 0, 0, NULL, NULL, '2025-08-15 13:14:17', '2025-08-08 12:02:40', 'Snowboard – Big Air (Best 2)', 'snowboard', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(127, 4, 3, 'Wielki finał', 'Points', 1, 'best_from_all', NULL, 0, NULL, 'none', NULL, 0, 0, 1, NULL, NULL, '2025-08-15 13:14:17', '2025-08-08 12:02:40', 'Freeski – Big Air (Best 2)', 'freeski', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(196, 3, 5, 'Super finał Junior', 'Points', 2, 'best_from_2', '00:00:00', 0, '[\"9\",\"10\"]', 'promotion', 2, 5, 0, 0, NULL, 6, '2025-08-15 13:14:17', '2025-08-08 12:02:40', 'Snowboard – Big Air (Best 2)', 'snowboard', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0),
(197, 3, 6, 'Super finał - senior', 'Points', 1, 'single_run', '00:00:00', 0, '[\"3\",\"1\"]', 'promotion', 4, 5, 0, 0, NULL, NULL, '2025-08-15 13:14:17', '2025-08-08 12:02:40', 'Snowboard – Big Air (Best 2)', 'snowboard', NULL, 0, 0, 0, NULL, 'standard', NULL, 5, 0.00, 100.00, 0);

-- --------------------------------------------------------

--
-- Table structure for table `event_notifications`
--

CREATE TABLE `event_notifications` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `type` enum('success','danger','warning','info') DEFAULT 'info',
  `category` enum('general','competition','participant','judge','system','heat','scoring','technical') DEFAULT 'general',
  `title` varchar(255) NOT NULL,
  `message` text DEFAULT NULL,
  `user_id` varchar(100) DEFAULT 'system',
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data`)),
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `event_participants`
--

CREATE TABLE `event_participants` (
  `id` int(11) NOT NULL,
  `event_id` int(11) DEFAULT NULL,
  `participant_id` int(11) DEFAULT NULL,
  `heat_number` int(11) DEFAULT NULL,
  `sort_order` int(11) DEFAULT 0,
  `bib_number` int(11) DEFAULT NULL,
  `category_id` int(11) DEFAULT NULL,
  `matching_category_ids` text DEFAULT NULL,
  `category` varchar(100) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `event_participants`
--

INSERT INTO `event_participants` (`id`, `event_id`, `participant_id`, `heat_number`, `sort_order`, `bib_number`, `category_id`, `matching_category_ids`, `category`, `created_at`) VALUES
(1489, 3, 1366, 1, 21, 12, 10, '[10,3,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1493, 3, 1360, 1, 36, 35, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1495, 3, 1357, 1, 23, 14, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1496, 3, 1356, 1, 25, 15, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1504, 3, 1348, 1, 37, 37, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1505, 3, 1347, 1, 26, 17, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1508, 3, 1344, 1, 2, 10, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1510, 3, 1342, 1, 33, 30, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1513, 3, 1339, 1, 34, 32, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1516, 3, 1336, 1, 35, 33, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1523, 3, 1329, 1, 27, 19, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1524, 3, 1328, 1, 28, 20, 10, '[10]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1527, 3, 1325, 1, 42, 50, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1532, 3, 1320, 1, 43, 53, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1533, 3, 1319, 1, 44, 54, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1535, 3, 1317, 1, 45, 55, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1536, 3, 1316, 1, 46, 56, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1538, 3, 1314, 1, 41, 47, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1540, 3, 1312, 1, 38, 41, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1543, 3, 1309, 1, 39, 43, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1544, 3, 1308, 1, 40, 44, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1545, 3, 1307, 1, 29, 22, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1550, 3, 1302, 1, 30, 25, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 00:31:04'),
(1551, 3, 1301, 1, 47, 57, 9, '[9]', 'Chłopcy junor', '2025-08-07 00:31:04'),
(1634, 3, 1358, 1, 10, 8, 10, '[10,3,11]', 'Dziewczynki junior', '2025-08-07 11:51:39'),
(1635, 3, 1340, 1, 4, 5, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 11:51:39'),
(1636, 3, 1338, 1, 17, 11, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 12:57:26'),
(1637, 3, 1337, 1, 13, 9, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 12:57:26'),
(1639, 3, 1333, 1, 6, 6, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 12:57:26'),
(1714, 3, 1343, 1, 31, 61, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 14:26:03'),
(1716, 3, 1331, 1, 32, 63, 10, '[10,11]', 'Dziewczynki junior', '2025-08-07 14:26:03'),
(2055, 3, 1366, 2, 8, 12, 10, '[10,3,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2056, 3, 1360, 2, 6, 35, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2057, 3, 1347, 2, 13, 17, 10, '[10,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2058, 3, 1344, 2, 11, 10, 10, '[10,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2059, 3, 1342, 2, 3, 30, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2060, 3, 1336, 2, 4, 33, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2061, 3, 1325, 2, 0, 50, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2062, 3, 1312, 2, 7, 41, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2063, 3, 1309, 2, 1, 43, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2064, 3, 1308, 2, 2, 44, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2065, 3, 1302, 2, 15, 25, 10, '[10,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2066, 3, 1301, 2, 5, 57, 9, '[9]', 'Chłopcy junor', '2025-08-14 23:12:42'),
(2067, 3, 1358, 2, 10, 8, 10, '[10,3,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2068, 3, 1340, 2, 14, 5, 10, '[10,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2069, 3, 1338, 2, 12, 11, 10, '[10,11]', 'Dziewczynki junior', '2025-08-14 23:12:42'),
(2070, 3, 1331, 2, 9, 63, 10, '[10,11]', 'Dziewczynki junior', '2025-08-14 23:12:42');

-- --------------------------------------------------------

--
-- Table structure for table `figure_categories`
--

CREATE TABLE `figure_categories` (
  `id` int(11) NOT NULL,
  `sport_name` varchar(100) NOT NULL,
  `category_name` varchar(100) NOT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `figure_categories`
--

INSERT INTO `figure_categories` (`id`, `sport_name`, `category_name`, `is_active`, `sort_order`) VALUES
(1, 'snowboard', 'Rotation', 1, 0),
(2, 'snowboard', 'Direction', 1, 1),
(3, 'snowboard', 'Axis', 1, 2),
(4, 'snowboard', 'Grab', 1, 3),
(5, 'snowboard', 'Feature', 1, 4),
(6, 'snowboard', 'Rail', 1, 5),
(7, 'freeski', 'Rotation', 1, 0),
(8, 'freeski', 'Direction', 1, 1),
(9, 'freeski', 'Axis', 1, 2),
(10, 'freeski', 'Grab', 1, 3),
(11, 'freeski', 'Feature', 1, 4),
(12, 'skateboard', 'Flip', 1, 0),
(13, 'skateboard', 'Grind/Slide', 1, 1),
(14, 'skateboard', 'Gap', 1, 2),
(15, 'skateboard', 'Obstacle', 1, 3),
(16, 'bmx', 'Tricks', 1, 0),
(17, 'bmx', 'Feature', 1, 1),
(18, 'inline', 'Grind', 1, 0),
(19, 'inline', 'Air', 1, 1),
(20, 'inline', 'Feature', 1, 2),
(21, 'surf', 'Maneuver', 1, 0),
(22, 'surf', 'Wave', 1, 1),
(23, 'kitesurf', 'Jump', 1, 0),
(24, 'kitesurf', 'Style', 1, 1),
(25, 'kitesurf', 'Grab', 1, 2),
(26, 'parkour', 'Move', 1, 0),
(27, 'parkour', 'Flow', 1, 1),
(28, 'breaking', 'Powermove', 1, 0),
(29, 'breaking', 'Footwork', 1, 1),
(30, 'breaking', 'Freeze', 1, 2),
(31, 'breaking', 'Blowup', 1, 3),
(32, 'wakeboard', 'Rail', 1, 0),
(33, 'wakeboard', 'Air', 1, 1),
(34, 'wakeboard', 'Feature', 1, 2);

-- --------------------------------------------------------

--
-- Table structure for table `figure_items`
--

CREATE TABLE `figure_items` (
  `id` int(11) NOT NULL,
  `sport_name` varchar(100) NOT NULL,
  `category_name` varchar(100) NOT NULL,
  `item_name` varchar(255) NOT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `figure_items`
--

INSERT INTO `figure_items` (`id`, `sport_name`, `category_name`, `item_name`, `is_active`, `sort_order`) VALUES
(1, 'snowboard', 'Rotation', '180', 1, 0),
(2, 'snowboard', 'Rotation', '360', 1, 1),
(3, 'snowboard', 'Rotation', '540', 1, 2),
(4, 'snowboard', 'Rotation', '720', 1, 3),
(5, 'snowboard', 'Rotation', '900', 1, 4),
(6, 'snowboard', 'Rotation', '1080', 1, 5),
(7, 'snowboard', 'Rotation', '1260', 1, 6),
(8, 'snowboard', 'Rotation', '1440', 1, 7),
(9, 'snowboard', 'Rotation', '1620', 1, 8),
(10, 'snowboard', 'Rotation', '1800', 1, 9),
(11, 'snowboard', 'Direction', 'Frontside', 1, 0),
(12, 'snowboard', 'Direction', 'Backside', 1, 1),
(13, 'snowboard', 'Direction', 'Switch FS', 1, 2),
(14, 'snowboard', 'Direction', 'Switch BS', 1, 3),
(15, 'snowboard', 'Axis', 'Flat', 1, 0),
(16, 'snowboard', 'Axis', 'Cork', 1, 1),
(17, 'snowboard', 'Axis', 'Double Cork', 1, 2),
(18, 'snowboard', 'Axis', 'Triple Cork', 1, 3),
(19, 'snowboard', 'Grab', 'Mute', 1, 0),
(20, 'snowboard', 'Grab', 'Indy', 1, 1),
(21, 'snowboard', 'Grab', 'Tail', 1, 2),
(22, 'snowboard', 'Grab', 'Nose', 1, 3),
(23, 'snowboard', 'Grab', 'Method', 1, 4),
(24, 'snowboard', 'Grab', 'Stalefish', 1, 5),
(25, 'snowboard', 'Grab', 'Melon', 1, 6),
(26, 'snowboard', 'Grab', 'Japan', 1, 7),
(27, 'snowboard', 'Grab', 'Seatbelt', 1, 8),
(28, 'snowboard', 'Feature', 'Kicker', 1, 0),
(29, 'snowboard', 'Feature', 'Rail', 1, 1),
(30, 'snowboard', 'Feature', 'Box', 1, 2),
(31, 'snowboard', 'Feature', 'Wallride', 1, 3),
(32, 'snowboard', 'Feature', 'Hip', 1, 4),
(33, 'snowboard', 'Rail', 'Boardslide', 1, 0),
(34, 'snowboard', 'Rail', 'Lipslide', 1, 1),
(35, 'snowboard', 'Rail', '270 In', 1, 2),
(36, 'snowboard', 'Rail', '270 Out', 1, 3),
(37, 'snowboard', 'Rail', '450 Out', 1, 4),
(38, 'freeski', 'Rotation', '180', 1, 0),
(39, 'freeski', 'Rotation', '360', 1, 1),
(40, 'freeski', 'Rotation', '540', 1, 2),
(41, 'freeski', 'Rotation', '720', 1, 3),
(42, 'freeski', 'Rotation', '900', 1, 4),
(43, 'freeski', 'Rotation', '1080', 1, 5),
(44, 'freeski', 'Rotation', '1260', 1, 6),
(45, 'freeski', 'Rotation', '1440', 1, 7),
(46, 'freeski', 'Rotation', '1620', 1, 8),
(47, 'freeski', 'Direction', 'Left', 1, 0),
(48, 'freeski', 'Direction', 'Right', 1, 1),
(49, 'freeski', 'Direction', 'Switch L', 1, 2),
(50, 'freeski', 'Direction', 'Switch R', 1, 3),
(51, 'freeski', 'Axis', 'Flat', 1, 0),
(52, 'freeski', 'Axis', 'Cork', 1, 1),
(53, 'freeski', 'Axis', 'Double Cork', 1, 2),
(54, 'freeski', 'Axis', 'Triple Cork', 1, 3),
(55, 'freeski', 'Grab', 'Safety', 1, 0),
(56, 'freeski', 'Grab', 'Mute', 1, 1),
(57, 'freeski', 'Grab', 'Tail', 1, 2),
(58, 'freeski', 'Grab', 'Japan', 1, 3),
(59, 'freeski', 'Grab', 'Blunt', 1, 4),
(60, 'freeski', 'Grab', 'Nose', 1, 5),
(61, 'freeski', 'Feature', 'Kicker', 1, 0),
(62, 'freeski', 'Feature', 'Rail', 1, 1),
(63, 'freeski', 'Feature', 'Box', 1, 2),
(64, 'freeski', 'Feature', 'Wallride', 1, 3),
(65, 'freeski', 'Feature', 'Hip', 1, 4),
(66, 'skateboard', 'Flip', 'Kickflip', 1, 0),
(67, 'skateboard', 'Flip', 'Heelflip', 1, 1),
(68, 'skateboard', 'Flip', 'Varial Flip', 1, 2),
(69, 'skateboard', 'Flip', 'Hardflip', 1, 3),
(70, 'skateboard', 'Flip', '360 Flip', 1, 4),
(71, 'skateboard', 'Flip', 'Impossible', 1, 5),
(72, 'skateboard', 'Grind/Slide', 'FS 50-50', 1, 0),
(73, 'skateboard', 'Grind/Slide', 'BS 50-50', 1, 1),
(74, 'skateboard', 'Grind/Slide', 'BS Smith', 1, 2),
(75, 'skateboard', 'Grind/Slide', 'FS Smith', 1, 3),
(76, 'skateboard', 'Grind/Slide', 'Crooked', 1, 4),
(77, 'skateboard', 'Grind/Slide', 'Nosegrind', 1, 5),
(78, 'skateboard', 'Grind/Slide', 'Feeble', 1, 6),
(79, 'skateboard', 'Grind/Slide', 'Boardslide', 1, 7),
(80, 'skateboard', 'Grind/Slide', 'Lipslide', 1, 8),
(81, 'skateboard', 'Gap', 'Ollie', 1, 0),
(82, 'skateboard', 'Gap', 'Nollie', 1, 1),
(83, 'skateboard', 'Gap', 'Switch Ollie', 1, 2),
(84, 'skateboard', 'Gap', '360', 1, 3),
(85, 'skateboard', 'Gap', 'Shuvit', 1, 4),
(86, 'skateboard', 'Obstacle', 'Rail', 1, 0),
(87, 'skateboard', 'Obstacle', 'Hubba', 1, 1),
(88, 'skateboard', 'Obstacle', 'Stairs', 1, 2),
(89, 'skateboard', 'Obstacle', 'Ledge', 1, 3),
(90, 'skateboard', 'Obstacle', 'Quarter', 1, 4),
(91, 'skateboard', 'Obstacle', 'Manual Pad', 1, 5),
(92, 'bmx', 'Tricks', 'Barspin', 1, 0),
(93, 'bmx', 'Tricks', 'Double Bar', 1, 1),
(94, 'bmx', 'Tricks', 'Tailwhip', 1, 2),
(95, 'bmx', 'Tricks', 'Double Whip', 1, 3),
(96, 'bmx', 'Tricks', 'Truckdriver (360 bar)', 1, 4),
(97, 'bmx', 'Tricks', 'Flair', 1, 5),
(98, 'bmx', 'Tricks', '720', 1, 6),
(99, 'bmx', 'Tricks', 'No-Hander', 1, 7),
(100, 'bmx', 'Tricks', 'Superman', 1, 8),
(101, 'bmx', 'Tricks', 'Decade', 1, 9),
(102, 'bmx', 'Tricks', 'Footjam', 1, 10),
(103, 'bmx', 'Feature', 'Quarter', 1, 0),
(104, 'bmx', 'Feature', 'Box Jump', 1, 1),
(105, 'bmx', 'Feature', 'Spine', 1, 2),
(106, 'bmx', 'Feature', 'Sub Box', 1, 3),
(107, 'bmx', 'Feature', 'Rail', 1, 4),
(108, 'bmx', 'Feature', 'Flyout', 1, 5),
(109, 'inline', 'Grind', 'Soul', 1, 0),
(110, 'inline', 'Grind', 'Royale', 1, 1),
(111, 'inline', 'Grind', 'Top Soul', 1, 2),
(112, 'inline', 'Grind', 'Top Acid', 1, 3),
(113, 'inline', 'Grind', 'Backslide', 1, 4),
(114, 'inline', 'Grind', 'Makio', 1, 5),
(115, 'inline', 'Grind', 'Fishbrain', 1, 6),
(116, 'inline', 'Air', '540', 1, 0),
(117, 'inline', 'Air', '720', 1, 1),
(118, 'inline', 'Air', '900', 1, 2),
(119, 'inline', 'Air', 'Alley Oop', 1, 3),
(120, 'inline', 'Air', 'Switch', 1, 4),
(121, 'inline', 'Feature', 'Rail', 1, 0),
(122, 'inline', 'Feature', 'Box', 1, 1),
(123, 'inline', 'Feature', 'Quarter', 1, 2),
(124, 'inline', 'Feature', 'Spine', 1, 3),
(125, 'surf', 'Maneuver', 'Cutback', 1, 0),
(126, 'surf', 'Maneuver', 'Snap', 1, 1),
(127, 'surf', 'Maneuver', 'Carve', 1, 2),
(128, 'surf', 'Maneuver', 'Re-entry', 1, 3),
(129, 'surf', 'Maneuver', 'Floater', 1, 4),
(130, 'surf', 'Maneuver', 'Aerial', 1, 5),
(131, 'surf', 'Maneuver', 'Tube', 1, 6),
(132, 'surf', 'Wave', 'Left', 1, 0),
(133, 'surf', 'Wave', 'Right', 1, 1),
(134, 'surf', 'Wave', 'Closeout', 1, 2),
(135, 'surf', 'Wave', 'Point', 1, 3),
(136, 'surf', 'Wave', 'Beachbreak', 1, 4),
(137, 'surf', 'Wave', 'Reef', 1, 5),
(138, 'kitesurf', 'Jump', 'Kiteloop', 1, 0),
(139, 'kitesurf', 'Jump', 'Double Loop', 1, 1),
(140, 'kitesurf', 'Jump', 'Late Backroll', 1, 2),
(141, 'kitesurf', 'Jump', 'Backroll', 1, 3),
(142, 'kitesurf', 'Jump', 'Frontroll', 1, 4),
(143, 'kitesurf', 'Jump', 'Board-off', 1, 5),
(144, 'kitesurf', 'Jump', 'One Foot', 1, 6),
(145, 'kitesurf', 'Style', 'Contraloop', 1, 0),
(146, 'kitesurf', 'Style', 'Boogie', 1, 1),
(147, 'kitesurf', 'Style', 'Darkslide', 1, 2),
(148, 'kitesurf', 'Style', 'Downloop', 1, 3),
(149, 'kitesurf', 'Grab', 'Tail', 1, 0),
(150, 'kitesurf', 'Grab', 'Nose', 1, 1),
(151, 'kitesurf', 'Grab', 'Mute', 1, 2),
(152, 'kitesurf', 'Grab', 'Indy', 1, 3),
(153, 'kitesurf', 'Grab', 'Seatbelt', 1, 4),
(154, 'parkour', 'Move', 'Kong', 1, 0),
(155, 'parkour', 'Move', 'Dash', 1, 1),
(156, 'parkour', 'Move', 'Speed Vault', 1, 2),
(157, 'parkour', 'Move', 'Lazy', 1, 3),
(158, 'parkour', 'Move', 'Precision', 1, 4),
(159, 'parkour', 'Move', 'Cat Leap', 1, 5),
(160, 'parkour', 'Move', 'Palm Spin', 1, 6),
(161, 'parkour', 'Move', 'Wall Run', 1, 7),
(162, 'parkour', 'Move', 'Backflip', 1, 8),
(163, 'parkour', 'Move', 'Gainer', 1, 9),
(164, 'parkour', 'Flow', 'Link-up', 1, 0),
(165, 'parkour', 'Flow', 'Direction Change', 1, 1),
(166, 'parkour', 'Flow', 'Stride', 1, 2),
(167, 'parkour', 'Flow', 'Bar Combo', 1, 3),
(168, 'breaking', 'Powermove', 'Windmill', 1, 0),
(169, 'breaking', 'Powermove', 'Flare', 1, 1),
(170, 'breaking', 'Powermove', 'Airflare', 1, 2),
(171, 'breaking', 'Powermove', 'Headspin', 1, 3),
(172, 'breaking', 'Powermove', 'Swipe', 1, 4),
(173, 'breaking', 'Powermove', 'Halo', 1, 5),
(174, 'breaking', 'Footwork', '6-step', 1, 0),
(175, 'breaking', 'Footwork', 'CCs', 1, 1),
(176, 'breaking', 'Footwork', 'Zulus', 1, 2),
(177, 'breaking', 'Footwork', 'Russian', 1, 3),
(178, 'breaking', 'Footwork', 'Knee Rock', 1, 4),
(179, 'breaking', 'Freeze', 'Baby', 1, 0),
(180, 'breaking', 'Freeze', 'Airchair', 1, 1),
(181, 'breaking', 'Freeze', 'Hollowback', 1, 2),
(182, 'breaking', 'Freeze', 'Chair', 1, 3),
(183, 'breaking', 'Freeze', 'Pike', 1, 4),
(184, 'breaking', 'Blowup', 'Combo', 1, 0),
(185, 'breaking', 'Blowup', 'Thread', 1, 1),
(186, 'breaking', 'Blowup', 'Power to Freeze', 1, 2),
(187, 'wakeboard', 'Rail', 'Front Board', 1, 0),
(188, 'wakeboard', 'Rail', 'Back Board', 1, 1),
(189, 'wakeboard', 'Rail', '270 In', 1, 2),
(190, 'wakeboard', 'Rail', '270 Out', 1, 3),
(191, 'wakeboard', 'Rail', 'Transfer', 1, 4),
(192, 'wakeboard', 'Rail', 'Press', 1, 5),
(193, 'wakeboard', 'Air', 'Tantrum', 1, 0),
(194, 'wakeboard', 'Air', 'Backroll', 1, 1),
(195, 'wakeboard', 'Air', 'Raley', 1, 2),
(196, 'wakeboard', 'Air', 'S-Bend', 1, 3),
(197, 'wakeboard', 'Air', '540', 1, 4),
(198, 'wakeboard', 'Air', '720', 1, 5),
(199, 'wakeboard', 'Air', 'KGB', 1, 6),
(200, 'wakeboard', 'Feature', 'Kicker', 1, 0),
(201, 'wakeboard', 'Feature', 'Rail', 1, 1),
(202, 'wakeboard', 'Feature', 'Funbox', 1, 2),
(203, 'wakeboard', 'Feature', 'Wall', 1, 3);

-- --------------------------------------------------------

--
-- Table structure for table `figure_sports`
--

CREATE TABLE `figure_sports` (
  `id` int(11) NOT NULL,
  `sport_name` varchar(100) NOT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `figure_sports`
--

INSERT INTO `figure_sports` (`id`, `sport_name`, `is_active`, `created_at`) VALUES
(1, 'snowboard', 1, '2025-08-15 04:20:10'),
(2, 'freeski', 1, '2025-08-15 04:20:10'),
(3, 'skateboard', 1, '2025-08-15 04:20:10'),
(4, 'bmx', 1, '2025-08-15 04:20:10'),
(5, 'inline', 1, '2025-08-15 04:20:10'),
(6, 'surf', 1, '2025-08-15 04:20:10'),
(7, 'kitesurf', 1, '2025-08-15 04:20:10'),
(8, 'parkour', 1, '2025-08-15 04:20:10'),
(9, 'breaking', 1, '2025-08-15 04:20:10'),
(10, 'wakeboard', 1, '2025-08-15 04:20:10');

-- --------------------------------------------------------

--
-- Table structure for table `group_event_access`
--

CREATE TABLE `group_event_access` (
  `id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `access_level` enum('view','judge','manage','own') DEFAULT 'view',
  `granted_by` int(11) DEFAULT NULL,
  `granted_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `judges`
--

CREATE TABLE `judges` (
  `id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `is_head` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `judge_assignments`
--

CREATE TABLE `judge_assignments` (
  `id` int(11) NOT NULL,
  `event_id` int(11) DEFAULT NULL,
  `judge_id` int(11) DEFAULT NULL,
  `event_control_point_id` int(11) DEFAULT NULL,
  `heat_number` int(11) DEFAULT NULL,
  `control_point_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `judge_assignments`
--

INSERT INTO `judge_assignments` (`id`, `event_id`, `judge_id`, `event_control_point_id`, `heat_number`, `control_point_id`) VALUES
(348, 3, 6, NULL, NULL, 2),
(349, 3, 29, NULL, NULL, 2),
(354, 3, 1, NULL, NULL, 1),
(356, 3, 3, NULL, NULL, 1);

-- --------------------------------------------------------

--
-- Table structure for table `participants`
--

CREATE TABLE `participants` (
  `id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `bib` int(11) DEFAULT NULL,
  `first_name` varchar(100) DEFAULT NULL,
  `last_name` varchar(100) DEFAULT NULL,
  `gender` enum('M','K','F') DEFAULT NULL,
  `fis_code` varchar(50) DEFAULT NULL,
  `licence_code` varchar(50) DEFAULT NULL,
  `licence_type` varchar(50) DEFAULT NULL,
  `club` varchar(255) DEFAULT NULL,
  `category` varchar(100) DEFAULT NULL,
  `created_at` date NOT NULL DEFAULT current_timestamp(),
  `imported_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `participants`
--

INSERT INTO `participants` (`id`, `name`, `country`, `date_of_birth`, `bib`, `first_name`, `last_name`, `gender`, `fis_code`, `licence_code`, `licence_type`, `club`, `category`, `created_at`, `imported_at`, `updated_at`) VALUES
(1301, NULL, 'CZ', '2006-02-13', 129, 'Andrzej', 'Rorat', 'M', '', '522', 'Pro', 'Freestyle Club', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1302, NULL, 'PL', '2015-03-20', 128, 'Natasza', 'Ziniewicz', 'F', '9829839', '529', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1303, NULL, 'PL', '1999-03-02', 127, 'Malwina', 'Prokopiak', 'F', '9444478', '', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1304, NULL, 'PL', '2004-09-02', 126, 'Natan', 'Kacperek', 'M', '9354020', '672', 'Pro', 'STOWARZYSZENIE HIGH 5', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1305, NULL, 'CZ', '2005-06-28', 125, 'Nicole', 'Rychcik', 'F', '9505082', '476', 'Pro', 'Wrocławski Klub Snowboardowy', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1306, NULL, 'CZ', '1998-05-19', 124, 'Robert', 'Lizoń', 'M', '9895917', '451', 'Pro', 'KS PROGRESS BIELSKO-BIAŁA', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1307, NULL, 'PL', '2014-07-23', 123, 'Klara', 'Duczmal', 'F', '9974338', '572', 'Pro', 'Wrocławski Klub Snowboardowy', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1308, NULL, 'SK', '2013-04-16', 121, 'Aleksander', 'Idec', 'M', '9667036', '603', 'Pro', 'Wrocławski Klub Snowboardowy', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1309, NULL, 'DE', '2013-03-24', 120, 'Robert', 'Pacholczak', 'M', '9153034', '656', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1310, NULL, 'CZ', '2002-01-21', 118, 'Ada', 'Drywa', 'F', '9678873', '472', 'Pro', 'Freestyle Club', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1311, NULL, 'DE', '1999-11-23', 116, 'Leon', 'Tondera', 'M', '9835798', '695', 'Pro', 'KS PROGRESS BIELSKO-BIAŁA', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1312, NULL, 'PL', '2013-02-19', 115, 'Stefan', 'Wasiewicz', 'M', '9436556', '490', 'Pro', 'STOWARZYSZENIE HIGH 5', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1313, NULL, 'DE', '2005-09-22', 113, 'Olaf', 'Warwas', 'M', '9306196', '326', 'Pro', 'KS PROGRESS BIELSKO-BIAŁA', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1314, NULL, 'CZ', '2012-09-22', 111, 'Mieszko', 'Sośniak', 'M', '9321403', '607', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1315, NULL, 'CZ', '1998-01-04', 108, 'Aleksander', 'Tabiś', 'M', '9159864', '534', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1316, NULL, 'CZ', '2009-03-05', 107, 'Arkadiusz', 'Dobroń', 'M', '9348755', '575', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1317, NULL, 'SK', '2012-08-27', 106, 'Rafał', 'Gadzała', 'M', '9395438', '422', 'Pro', 'Wrocławski Klub Snowboardowy', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1318, NULL, 'DE', '2004-01-14', 105, 'Rozalia', 'Graboś', 'F', '9821793', '653', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1319, NULL, 'DE', '2010-07-15', 104, 'Jakub', 'Wenzel', 'M', '9482927', '459', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1320, NULL, 'PL', '2014-06-02', 102, 'Jerzy', 'Dorobek', 'M', '9162653', '444', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1321, NULL, 'PL', '1999-03-21', 99, 'Cezary', 'Hrabia', 'M', '9705326', '513', 'Pro', 'STOWARZYSZENIE HIGH 5', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1322, NULL, 'PL', '1995-10-21', 98, 'Marika', 'Protasiuk', 'F', '9329231', '570', 'Pro', 'Wrocławski Klub Snowboardowy', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1323, NULL, 'PL', '1998-04-28', 95, 'Olga', 'Ziemak', 'F', '9263637', '334', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1324, NULL, 'SK', '2005-09-01', 94, 'Ignacy', 'Sobisz', 'M', '9765139', '428', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1325, NULL, 'DE', '2012-07-26', 93, 'Ryszard', 'Zmarzły', 'M', '9165658', '580', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1326, NULL, 'PL', '2001-05-12', 91, 'Eliza', 'Sularz', 'F', '9338295', '447', 'Pro', 'KS PROGRESS BIELSKO-BIAŁA', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1327, NULL, 'SK', '1996-04-18', 90, 'Alan', 'Jędraszczyk', 'M', '9052367', '331', 'Pro', 'Freestyle Club', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1328, NULL, 'DE', '2007-10-02', 89, 'Sonia', 'Wawrzkiewicz', 'F', '', '674', 'Pro', 'Snow Unity Kraków', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1329, NULL, 'PL', '2014-01-10', 88, 'Urszula', 'Rosłon', 'F', '9096567', '356', 'Pro', 'Snow Unity Kraków', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1330, NULL, 'DE', '2003-09-12', 87, 'Andrzej', 'Guziak', 'M', '9417341', '501', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1331, NULL, 'PL', '2009-05-27', 86, 'Julianna', 'Łuckiewicz', 'F', '9011971', '473', 'Pro', 'Freestyle Club', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1332, NULL, 'SK', '1999-01-19', 85, 'Klara', 'Stąpor', 'F', '9470559', '475', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1333, NULL, 'SK', '2014-03-28', 83, 'Nela', 'Madziar', 'F', '9721039', '468', 'Pro', 'Wrocławski Klub Snowboardowy', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1334, NULL, 'SK', '2001-05-19', 81, 'Rozalia', 'Indyk', 'F', '9365266', '361', 'Pro', 'Snow Unity Kraków', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1335, NULL, 'CZ', '1996-10-10', 80, 'Kamil', 'Pacia', 'M', '9447974', '661', 'Pro', 'KS PROGRESS BIELSKO-BIAŁA', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1336, NULL, 'SK', '2011-03-06', 79, 'Nikodem', 'Moroń', 'M', '9365744', '380', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1337, NULL, 'SK', '2010-10-29', 78, 'Marika', 'Wikło', 'F', '9314545', '417', 'Pro', 'Freestyle Club', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1338, NULL, 'DE', '2013-10-14', 77, 'Monika', 'Maruszczyk', 'F', '9293354', '408', 'Pro', 'STOWARZYSZENIE HIGH 5', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1339, NULL, 'PL', '2010-02-11', 76, 'Igor', 'Masiak', 'M', '9278987', '368', 'Pro', 'Snow Unity Kraków', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1340, NULL, 'SK', '2011-02-16', 75, 'Dorota', 'Pezda', 'F', '9018565', '676', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1341, NULL, 'PL', '1995-09-12', 73, 'Nikodem', 'Budzeń', 'M', '9424006', '545', 'Pro', 'Wrocławski Klub Snowboardowy', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1342, NULL, 'CZ', '2008-05-16', 72, 'Igor', 'Kupaj', 'M', '9877699', '507', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1343, NULL, 'PL', '2012-05-06', 71, 'Urszula', 'Pyszny', 'F', '9610573', '509', 'Pro', 'Wrocławski Klub Snowboardowy', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1344, NULL, 'PL', '2008-06-04', 70, 'Melania', 'Siebert', 'F', '9496010', '396', 'Pro', 'Wrocławski Klub Snowboardowy', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1345, NULL, 'SK', '1999-05-12', 68, 'Ada', 'Wochnik', 'F', '9341176', '548', 'Pro', 'Freestyle Club', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1346, NULL, 'PL', '1998-04-21', 67, 'Maks', 'Suchenek', 'M', '9642780', '390', 'Pro', 'Wrocławski Klub Snowboardowy', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1347, NULL, 'DE', '2011-11-08', 66, 'Karina', 'Mila', 'F', '9226732', '543', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1348, NULL, 'DE', '2007-11-21', 65, 'Olaf', 'Piechura', 'M', '9449781', '622', 'Pro', 'Snow Unity Kraków', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1349, NULL, 'SK', '1994-10-04', 62, 'Jacek', 'Lelito', 'M', '9312827', '552', 'Pro', 'Freestyle Club', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1350, NULL, 'DE', '2003-07-18', 60, 'Sonia', 'Kansy', 'F', '9348122', '410', 'Pro', 'Wrocławski Klub Snowboardowy', 'Seniorzy', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1351, NULL, 'PL', '0000-00-00', 58, 'JAKUB', 'NAWROCKI', 'M', '9430224', '505', 'Pro', 'KS AZS AWF KATOWICE', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1352, NULL, 'PL', '0000-00-00', 56, 'TYMOTEUSZ', 'R??AK', 'M', '9430232', '847', 'Pro', 'KLUB SPORTOWY AZS ZAKOPANE', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1353, NULL, 'PL', '0000-00-00', 55, 'TYMOTEUSZ', 'SZOT', 'M', '9430226', '774', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1354, NULL, 'PL', '0000-00-00', 50, 'VALERIY', 'SYTYKH', 'M', '9430234', '776', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1355, NULL, 'PL', '0000-00-00', 49, 'JOANNA', 'W?SIK', 'F', '9435124', '814', 'Pro', 'KS AZS AWF KATOWICE', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1356, NULL, 'PL', '2017-06-14', 48, 'ANTONINA', 'STASINOWSKA', 'F', '9435127', '800', 'Pro', 'Freestyle Club', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1357, NULL, 'PL', '2018-06-15', 46, 'MATYLDA', 'ŻUROWSKA', 'F', '9435125', '840', 'Pro', 'KS AZS AWF KATOWICE', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1358, NULL, 'PL', NULL, 45, 'ZOFIA', 'MAMROWICZ', 'F', '9435126', '841', 'Pro', 'KS AZS AWF KATOWICE', 'Junior (U18)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1359, NULL, 'PL', '0000-00-00', 44, 'FRANCISZEK', 'BARAN', 'M', '9430233', '521', 'Pro', 'KS AZS AWF Wroc?aw', 'Junior M?odszy (U15)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1360, NULL, 'PL', '2025-07-03', 32, 'BORYS', 'RABIAŃSKI', 'M', '9430239', '839', 'Pro', 'KS SNPTT-1907', 'Junior M?odszy (U15)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1365, NULL, 'PL', '1999-12-28', 26, 'ZUZANNA', 'MACHOWSKA', 'F', '9435123', '752', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior M?odszy (U15)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1366, NULL, 'PL', NULL, 0, 'ZUZANNA', 'SIELAŻCZYK', 'F', '9435122', '854', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'Junior M?odszy (U15)', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22'),
(1367, NULL, 'CZ', '1999-12-14', 92, 'Dagmara', 'Guściora', 'F', '9709838', '498', 'Pro', 'AKADEMIA SPORTU FREESTYLE PARK', 'OPEN', '2025-08-06', '2025-08-06 22:34:22', '2025-08-06 22:34:22');

-- --------------------------------------------------------

--
-- Table structure for table `participants_event`
--

CREATE TABLE `participants_event` (
  `id` int(11) NOT NULL,
  `participant_id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `imported_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `participants_event`
--

INSERT INTO `participants_event` (`id`, `participant_id`, `event_id`, `imported_at`) VALUES
(541, 1366, 3, '2025-08-06 22:30:39'),
(542, 1365, 3, '2025-08-06 22:30:39'),
(547, 1360, 3, '2025-08-06 22:30:39'),
(550, 1357, 3, '2025-08-06 22:30:39'),
(551, 1356, 3, '2025-08-06 22:30:39'),
(557, 1350, 3, '2025-08-06 22:30:39'),
(558, 1349, 3, '2025-08-06 22:30:39'),
(559, 1348, 3, '2025-08-06 22:30:39'),
(560, 1347, 3, '2025-08-06 22:30:39'),
(561, 1346, 3, '2025-08-06 22:30:39'),
(562, 1345, 3, '2025-08-06 22:30:39'),
(563, 1344, 3, '2025-08-06 22:30:39'),
(564, 1343, 3, '2025-08-06 22:30:39'),
(565, 1342, 3, '2025-08-06 22:30:39'),
(566, 1341, 3, '2025-08-06 22:30:39'),
(568, 1339, 3, '2025-08-06 22:30:39'),
(570, 1337, 3, '2025-08-06 22:30:39'),
(571, 1336, 3, '2025-08-06 22:30:39'),
(572, 1335, 3, '2025-08-06 22:30:39'),
(573, 1334, 3, '2025-08-06 22:30:39'),
(574, 1333, 3, '2025-08-06 22:30:39'),
(575, 1332, 3, '2025-08-06 22:30:39'),
(576, 1331, 3, '2025-08-06 22:30:39'),
(577, 1330, 3, '2025-08-06 22:30:39'),
(578, 1329, 3, '2025-08-06 22:30:39'),
(579, 1328, 3, '2025-08-06 22:30:39'),
(580, 1327, 3, '2025-08-06 22:30:39'),
(581, 1326, 3, '2025-08-06 22:30:39'),
(582, 1325, 3, '2025-08-06 22:30:39'),
(583, 1324, 3, '2025-08-06 22:30:39'),
(584, 1323, 3, '2025-08-06 22:30:39'),
(585, 1322, 3, '2025-08-06 22:30:39'),
(586, 1321, 3, '2025-08-06 22:30:39'),
(587, 1320, 3, '2025-08-06 22:30:39'),
(588, 1319, 3, '2025-08-06 22:30:39'),
(589, 1318, 3, '2025-08-06 22:30:39'),
(590, 1317, 3, '2025-08-06 22:30:39'),
(591, 1316, 3, '2025-08-06 22:30:39'),
(592, 1315, 3, '2025-08-06 22:30:39'),
(593, 1314, 3, '2025-08-06 22:30:39'),
(594, 1313, 3, '2025-08-06 22:30:39'),
(595, 1312, 3, '2025-08-06 22:30:39'),
(596, 1311, 3, '2025-08-06 22:30:39'),
(597, 1310, 3, '2025-08-06 22:30:39'),
(598, 1309, 3, '2025-08-06 22:30:39'),
(599, 1308, 3, '2025-08-06 22:30:39'),
(600, 1307, 3, '2025-08-06 22:30:39'),
(601, 1306, 3, '2025-08-06 22:30:39'),
(602, 1305, 3, '2025-08-06 22:30:39'),
(603, 1304, 3, '2025-08-06 22:30:39'),
(604, 1303, 3, '2025-08-06 22:30:39'),
(605, 1302, 3, '2025-08-06 22:30:39'),
(606, 1301, 3, '2025-08-06 22:30:39'),
(682, 1359, 3, '2025-08-06 22:33:12'),
(686, 1355, 3, '2025-08-06 22:33:12'),
(687, 1354, 3, '2025-08-06 22:33:12'),
(688, 1353, 3, '2025-08-06 22:33:12'),
(689, 1352, 3, '2025-08-06 22:33:12'),
(690, 1351, 3, '2025-08-06 22:33:12'),
(809, 1367, 3, '2025-08-06 23:03:30'),
(810, 1358, 3, '2025-08-06 23:03:30'),
(811, 1340, 3, '2025-08-06 23:03:30'),
(812, 1338, 3, '2025-08-06 23:03:30');

-- --------------------------------------------------------

--
-- Table structure for table `result_configurations`
--

CREATE TABLE `result_configurations` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `view_type` enum('start_list','summary_table') NOT NULL,
  `event_id` int(11) NOT NULL,
  `heat_number` int(11) DEFAULT NULL,
  `category` varchar(100) DEFAULT NULL,
  `configuration` text NOT NULL COMMENT 'JSON configuration data',
  `display_order` int(11) NOT NULL DEFAULT 0,
  `status` enum('active','draft','public','private') NOT NULL DEFAULT 'draft',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `result_configurations`
--

INSERT INTO `result_configurations` (`id`, `name`, `view_type`, `event_id`, `heat_number`, `category`, `configuration`, `display_order`, `status`, `created_by`, `created_at`, `updated_at`) VALUES
(14, 'Lista startowa ogólna', 'start_list', 3, NULL, NULL, '{\"genderFilter\":\"all\"}', 0, 'active', 1, '2025-08-08 20:30:57', '2025-08-14 21:31:02'),
(16, 'Summary Table - Hocki Klocki - Heat 1 - Wszystkie kategorie', 'summary_table', 3, 1, NULL, '{\"showRank\":true,\"showBIP\":true,\"showParticipant\":true,\"showCategory\":false,\"showClub\":true,\"showGender\":false,\"showFisCode\":false,\"showLicenceCode\":false,\"showCountryCode\":false,\"showFigures\":true,\"showRuns\":true,\"showJudges\":false,\"showControlPoints\":false,\"showHeatBest\":true,\"showHeatAverage\":false,\"showOverallBest\":false,\"showHighestAverage\":false,\"sortBy\":\"OverallAverage\",\"sortDirection\":\"desc\",\"genderFilter\":\"all\",\"columnRenames\":{\"rank\":\"Miej\",\"participant\":\"Nazwisko Imi\\u0119\"}}', 0, 'active', 1, '2025-08-10 19:59:05', '2025-08-15 18:02:27'),
(20, 'Lista startowa - Finał Junior', 'start_list', 3, 2, NULL, '{\"genderFilter\":\"all\"}', 0, 'active', 1, '2025-08-13 17:15:57', '2025-08-14 21:31:28'),
(23, 'Start List - Hocki Klocki - Heat 1', 'start_list', 3, 1, NULL, '{\"genderFilter\":\"all\"}', 0, 'active', 1, '2025-08-14 23:35:42', '2025-08-14 23:35:42'),
(26, 'Summary Table - Hocki Klocki - Heat 1 - 10', 'summary_table', 3, 1, '10', '{\"showRank\":true,\"showBIB\":true,\"showParticipant\":true,\"showCategory\":true,\"showClub\":true,\"showGender\":true,\"showFisCode\":false,\"showLicenceCode\":false,\"showCountry\":false,\"showRuns\":true,\"showJudges\":false,\"showControlPoints\":false,\"showHeatBest\":true,\"showHeatAverage\":false,\"showOverallBest\":false,\"showHighestAverage\":false,\"sortBy\":\"OverallAverage\",\"sortDirection\":\"desc\",\"genderFilter\":\"all\",\"columnRenames\":{\"rank\":\"Miej\",\"participant\":\"Nazwisko Imi\\u0119\"}}', 0, 'active', 1, '2025-08-15 18:01:13', '2025-08-15 18:03:02');

-- --------------------------------------------------------

--
-- Table structure for table `result_styling`
--

CREATE TABLE `result_styling` (
  `id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `config_id` int(11) DEFAULT NULL,
  `styling_data` longtext NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `result_styling`
--

INSERT INTO `result_styling` (`id`, `event_id`, `config_id`, `styling_data`, `created_at`, `updated_at`) VALUES
(14, 3, 0, '{\"header_content\":\"<h1 style=\\\"margin: 0; color: #1f2937; font-weight: bold; text-align: center;\\\">OFFICIAL RESULTS<\\/h1>\\n<p style=\\\"margin: 10px 0 0 0; font-size: 16px; text-align: center; font-weight: 600;\\\">Championship Competition<\\/p>\",\"footer_content\":\"<p style=\\\"margin: 0; text-align: center; font-size: 12px;\\\"><strong>CERTIFIED OFFICIAL RESULTS<\\/strong><br>This document contains the official results as certified by the competition committee.<br><em>Any protests must be submitted within 24 hours of publication<\\/em><\\/p>\",\"logo_url\":\"..\\/uploads\\/logos\\/logo_1755199424_689e37c0d803a.gif\",\"logo_position\":\"left\",\"logo_size\":\"large\",\"font_family\":\"\",\"font_size\":\"9\",\"primary_color\":\"#1f2937\",\"secondary_color\":\"#6b7280\",\"table_style\":\"bordered\",\"page_margins\":\"normal\",\"show_event_info\":\"1\",\"show_generation_date\":\"1\",\"custom_css\":\"\",\"watermark_text\":\"\",\"watermark_opacity\":\"0.15\"}', '2025-07-28 19:51:38', '2025-08-17 02:00:28');

-- --------------------------------------------------------

--
-- Table structure for table `runs`
--

CREATE TABLE `runs` (
  `id` int(11) NOT NULL,
  `event_participant_id` int(11) DEFAULT NULL,
  `run_number` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `runs`
--

INSERT INTO `runs` (`id`, `event_participant_id`, `run_number`) VALUES
(387, 1508, 1),
(389, 1635, 1),
(390, 1639, 1),
(392, 1634, 1),
(393, 1524, 1),
(394, 1637, 1),
(395, 1636, 1),
(397, 1489, 1),
(401, 1508, 2),
(402, 1527, 2),
(411, 1495, 1),
(412, 1496, 1),
(413, 1635, 2),
(414, 1639, 2),
(416, 1634, 2),
(417, 1637, 2),
(418, 1636, 2),
(419, 1489, 2),
(420, 1495, 2),
(424, 1496, 2),
(425, 1527, 1),
(426, 1505, 1),
(428, 1523, 1),
(432, 1714, 1),
(433, 1545, 1),
(434, 1716, 1),
(435, 1550, 1),
(436, 1516, 1),
(439, 1510, 1),
(440, 1513, 1),
(441, 1513, 2),
(442, 1504, 1),
(443, 1540, 1),
(444, 1532, 1),
(446, 1493, 1),
(448, 1536, 1),
(449, 1543, 1),
(450, 1544, 1),
(451, 1538, 1),
(452, 1533, 1),
(453, 1535, 1),
(454, 1551, 1),
(455, 1550, 2),
(456, 1505, 2),
(458, 1523, 2),
(459, 1524, 2),
(461, 1545, 2),
(464, 1714, 2),
(465, 1716, 2),
(466, 1510, 2),
(467, 1516, 2),
(468, 1493, 2),
(469, 1504, 2),
(470, 1540, 2),
(471, 1543, 2),
(472, 1544, 2),
(473, 1551, 2),
(475, 1533, 2),
(476, 1508, 3),
(477, 1639, 3),
(478, 1635, 3),
(479, 1538, 2),
(480, 1634, 3),
(481, 1637, 3),
(482, 1532, 2),
(483, 1532, 3),
(484, 1535, 2),
(485, 1636, 3);

-- --------------------------------------------------------

--
-- Table structure for table `scores`
--

CREATE TABLE `scores` (
  `id` int(11) NOT NULL,
  `run_id` int(11) DEFAULT NULL,
  `judge_id` int(11) DEFAULT NULL,
  `control_point_id` int(11) DEFAULT NULL,
  `score_value` decimal(5,2) DEFAULT NULL,
  `status` enum('OK','DNS','DNF','DSQ') DEFAULT 'OK',
  `figures_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`figures_json`)),
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `is_approved` tinyint(1) DEFAULT 0,
  `approved_by` int(11) DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scores`
--

INSERT INTO `scores` (`id`, `run_id`, `judge_id`, `control_point_id`, `score_value`, `status`, `figures_json`, `created_at`, `updated_at`, `is_approved`, `approved_by`, `approved_at`) VALUES
(679, 387, 6, NULL, 55.00, 'OK', NULL, '2025-08-08 00:34:03', '2025-08-08 00:35:32', 1, 1, '2025-08-07 22:35:32'),
(680, 387, 29, NULL, 99.00, 'OK', '{\"Rotation\":[\"180\"],\"Direction\":[\"Frontside\"],\"Axis\":[\"Flat\"]}', '2025-08-08 00:34:36', '2025-08-15 16:51:11', 1, 1, '2025-08-15 14:51:11'),
(681, 387, 1, NULL, 0.00, '', NULL, '2025-08-16 16:55:41', '2025-08-16 16:55:41', 1, 1, '2025-08-14 09:57:37'),
(682, 387, 3, NULL, 99.00, 'OK', NULL, '2025-08-08 00:34:42', '2025-08-12 02:33:07', 1, 1, '2025-08-12 00:33:07'),
(687, 389, 6, NULL, 99.00, 'OK', NULL, '2025-08-08 00:41:38', '2025-08-12 04:08:22', 1, 1, '2025-08-12 02:08:22'),
(688, 389, 29, NULL, 50.00, 'OK', NULL, '2025-08-08 00:41:41', '2025-08-12 01:30:38', 1, 1, '2025-08-11 23:30:38'),
(689, 389, 1, NULL, 77.00, 'OK', NULL, '2025-08-08 00:41:45', '2025-08-12 01:58:12', 1, 1, '2025-08-11 23:58:12'),
(690, 389, 3, NULL, 99.00, 'OK', NULL, '2025-08-08 00:41:48', '2025-08-12 04:08:22', 1, 1, '2025-08-12 02:08:22'),
(691, 390, 6, NULL, 88.00, 'OK', NULL, '2025-08-08 00:42:43', '2025-08-08 00:43:45', 1, 1, '2025-08-07 22:43:45'),
(692, 390, 29, NULL, 55.00, 'OK', NULL, '2025-08-08 00:43:21', '2025-08-08 00:43:53', 1, 1, '2025-08-07 22:43:53'),
(693, 390, 1, NULL, 0.00, '', NULL, '2025-08-16 16:38:21', '2025-08-16 16:38:21', 1, 1, '2025-08-07 22:43:44'),
(694, 390, 3, NULL, 89.00, 'OK', NULL, '2025-08-08 00:43:28', '2025-08-12 02:01:01', 1, 1, '2025-08-12 00:01:01'),
(699, 392, 1, NULL, 65.00, 'OK', NULL, '2025-08-08 01:03:26', '2025-08-08 01:09:45', 1, 1, '2025-08-07 23:09:45'),
(700, 393, 1, NULL, 35.00, 'OK', NULL, '2025-08-08 01:03:33', '2025-08-10 17:27:37', 1, 1, '2025-08-10 15:27:37'),
(701, 394, 1, NULL, 91.00, 'OK', NULL, '2025-08-08 01:03:57', '2025-08-12 01:59:16', 1, 1, '2025-08-11 23:59:16'),
(702, 395, 1, NULL, 60.00, 'OK', NULL, '2025-08-08 01:05:43', '2025-08-08 09:38:22', 1, 1, '2025-08-08 07:38:22'),
(704, 397, 1, NULL, 65.00, 'OK', NULL, '2025-08-08 01:07:47', '2025-08-08 09:38:22', 1, 1, '2025-08-08 07:38:22'),
(707, 392, 6, NULL, 45.00, 'OK', NULL, '2025-08-08 01:09:37', '2025-08-08 01:09:45', 1, 1, '2025-08-07 23:09:45'),
(708, 392, 29, NULL, 65.00, 'OK', NULL, '2025-08-08 01:09:40', '2025-08-08 01:09:45', 1, 1, '2025-08-07 23:09:45'),
(709, 392, 3, NULL, 77.00, 'OK', NULL, '2025-08-08 01:09:43', '2025-08-08 01:09:45', 1, 1, '2025-08-07 23:09:45'),
(711, 401, 1, NULL, 55.00, 'OK', NULL, '2025-08-08 01:15:01', '2025-08-15 17:02:53', 1, 1, '2025-08-15 15:02:53'),
(712, 402, 1, NULL, 20.00, 'OK', NULL, '2025-08-08 01:15:15', '2025-08-12 04:22:22', 1, 1, '2025-08-12 02:22:22'),
(721, 411, 1, NULL, 99.00, 'OK', NULL, '2025-08-08 03:35:03', '2025-08-08 09:38:24', 1, 1, '2025-08-08 07:38:24'),
(722, 412, 1, NULL, 70.00, 'OK', NULL, '2025-08-08 03:35:30', '2025-08-08 09:02:50', 1, 1, '2025-08-08 07:02:50'),
(723, 413, 1, NULL, 78.00, 'OK', NULL, '2025-08-08 03:35:46', '2025-08-12 04:19:19', 1, 1, '2025-08-12 02:19:19'),
(724, 414, 1, NULL, 45.00, 'OK', NULL, '2025-08-08 03:35:50', '2025-08-12 04:19:28', 1, 1, '2025-08-12 02:19:28'),
(726, 416, 1, NULL, 96.00, 'OK', NULL, '2025-08-08 03:35:54', '2025-08-12 04:19:33', 1, 1, '2025-08-12 02:19:33'),
(727, 417, 1, NULL, 27.00, 'OK', NULL, '2025-08-08 03:35:55', '2025-08-12 04:19:41', 1, 1, '2025-08-12 02:19:41'),
(728, 418, 1, NULL, 87.00, 'OK', NULL, '2025-08-08 03:35:57', '2025-08-12 04:19:44', 1, 1, '2025-08-12 02:19:44'),
(729, 419, 1, NULL, 99.00, 'OK', NULL, '2025-08-08 03:36:19', '2025-08-12 04:19:51', 1, 1, '2025-08-12 02:19:51'),
(730, 420, 1, NULL, 11.00, 'OK', NULL, '2025-08-08 03:44:40', '2025-08-12 04:19:58', 1, 1, '2025-08-12 02:19:58'),
(734, 424, 6, NULL, 75.00, 'OK', NULL, '2025-08-08 09:02:26', '2025-08-12 04:20:05', 1, 1, '2025-08-12 02:20:05'),
(735, 425, 29, NULL, 99.00, 'OK', NULL, '2025-08-08 09:35:36', '2025-08-08 09:35:44', 1, 1, '2025-08-08 07:35:44'),
(736, 426, 1, NULL, 54.00, 'OK', NULL, '2025-08-08 23:15:40', '2025-08-12 02:29:26', 1, 1, '2025-08-12 00:29:26'),
(738, 428, 1, NULL, 97.00, 'OK', NULL, '2025-08-08 23:17:28', '2025-08-15 05:02:48', 1, 1, '2025-08-15 03:02:48'),
(742, 432, 1, NULL, 76.00, 'OK', NULL, '2025-08-10 16:53:56', '2025-08-12 01:34:12', 1, 1, '2025-08-11 23:34:12'),
(743, 433, 1, NULL, 90.00, 'OK', NULL, '2025-08-10 17:42:18', '2025-08-12 01:47:39', 1, 1, '2025-08-11 23:47:39'),
(744, 434, 1, NULL, 97.00, 'OK', NULL, '2025-08-10 17:43:15', '2025-08-12 01:02:48', 1, 1, '2025-08-11 23:02:48'),
(745, 435, 1, NULL, 70.00, 'OK', NULL, '2025-08-10 18:36:29', '2025-08-12 01:02:36', 1, 1, '2025-08-11 23:02:36'),
(746, 436, 1, NULL, 85.00, 'OK', NULL, '2025-08-10 19:41:04', '2025-08-14 12:00:05', 1, 1, '2025-08-14 10:00:05'),
(749, 439, 1, NULL, 15.00, 'OK', NULL, '2025-08-10 20:01:28', '2025-08-12 01:02:57', 1, 1, '2025-08-11 23:02:57'),
(750, 439, 1, NULL, 85.00, 'OK', NULL, '2025-08-10 20:04:09', '2025-08-14 11:59:18', 1, 1, '2025-08-14 09:59:18'),
(751, 440, 1, NULL, 73.00, 'OK', NULL, '2025-08-10 20:10:16', '2025-08-12 01:03:08', 1, 1, '2025-08-11 23:03:08'),
(752, 441, 1, NULL, 3.00, 'OK', NULL, '2025-08-10 20:10:37', '2025-08-12 04:22:21', 1, 1, '2025-08-12 02:22:21'),
(753, 442, 1, NULL, 64.00, 'OK', NULL, '2025-08-10 20:58:10', '2025-08-12 01:09:16', 1, 1, '2025-08-11 23:09:16'),
(754, 443, 1, NULL, 79.00, 'OK', NULL, '2025-08-10 20:58:27', '2025-08-12 01:03:43', 1, 1, '2025-08-11 23:03:43'),
(755, 444, 1, NULL, 73.00, 'OK', '{\"figures\":{\"Rotation\":[\"360\"],\"Direction\":[\"Switch FS\"],\"Axis\":[\"Cork\"],\"Grab\":[\"Tail\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755380485361,\"run_number\":\"manual_edit\",\"client_validated\":true,\"diversity_rules_checked\":0}}', '2025-08-10 20:58:41', '2025-08-16 23:41:26', 1, 1, '2025-08-11 23:12:55'),
(757, 446, 1, NULL, 80.00, 'OK', NULL, '2025-08-10 20:59:24', '2025-08-12 01:09:24', 1, 1, '2025-08-11 23:09:24'),
(759, 448, 1, NULL, 74.00, 'OK', NULL, '2025-08-10 21:00:05', '2025-08-12 01:13:22', 1, 1, '2025-08-11 23:13:22'),
(760, 449, 1, NULL, 94.00, 'OK', '{\"Rotation\":[\"180\"],\"Direction\":[\"Frontside\"]}', '2025-08-10 21:02:30', '2025-08-15 16:24:57', 1, 1, '2025-08-15 14:24:57'),
(761, 450, 1, NULL, 92.00, 'OK', NULL, '2025-08-10 21:02:42', '2025-08-12 01:10:11', 1, 1, '2025-08-11 23:10:11'),
(762, 451, 1, NULL, 45.00, 'OK', NULL, '2025-08-10 21:03:46', '2025-08-12 01:12:44', 1, 1, '2025-08-11 23:12:44'),
(763, 452, 1, NULL, 15.00, 'OK', '{\"Rotation\":[\"360\"],\"Direction\":[\"Backside\"],\"Axis\":[\"Cork\"],\"Grab\":[\"Indy\"]}', '2025-08-10 21:05:55', '2025-08-15 15:47:33', 1, 1, '2025-08-15 13:47:33'),
(764, 453, 1, NULL, 75.00, 'OK', NULL, '2025-08-10 21:07:15', '2025-08-12 01:13:06', 1, 1, '2025-08-11 23:13:06'),
(765, 454, 1, NULL, 78.00, 'OK', NULL, '2025-08-10 21:11:02', '2025-08-12 01:13:31', 1, 1, '2025-08-11 23:13:31'),
(766, 397, 29, NULL, 10.00, 'OK', NULL, '2025-08-11 00:58:18', '2025-08-11 00:58:22', 1, 1, '2025-08-10 22:58:22'),
(767, 411, 29, NULL, 85.00, 'OK', NULL, '2025-08-11 00:58:41', '2025-08-11 00:59:33', 1, 1, '2025-08-10 22:59:33'),
(768, 412, 29, NULL, 10.00, 'OK', NULL, '2025-08-11 01:00:01', '2025-08-12 01:02:15', 1, 1, '2025-08-11 23:02:15'),
(769, 455, 1, NULL, 81.00, 'OK', NULL, '2025-08-11 01:02:28', '2025-08-12 04:20:40', 1, 1, '2025-08-12 02:20:40'),
(770, 424, 1, NULL, 26.00, 'OK', NULL, '2025-08-11 01:04:04', '2025-08-12 04:20:05', 1, 1, '2025-08-12 02:20:05'),
(771, 456, 1, NULL, 30.00, 'OK', NULL, '2025-08-11 01:04:06', '2025-08-12 04:20:10', 1, 1, '2025-08-12 02:20:10'),
(773, 458, 1, NULL, 75.00, 'OK', NULL, '2025-08-11 01:04:08', '2025-08-12 04:20:15', 1, 1, '2025-08-12 02:20:15'),
(774, 459, 1, NULL, 63.00, 'OK', NULL, '2025-08-11 01:04:10', '2025-08-12 04:20:28', 1, 1, '2025-08-12 02:20:28'),
(776, 461, 1, NULL, 67.00, 'OK', NULL, '2025-08-11 01:04:13', '2025-08-12 04:20:36', 1, 1, '2025-08-12 02:20:36'),
(778, 394, 3, NULL, 44.00, 'OK', NULL, '2025-08-12 02:02:18', '2025-08-12 02:02:23', 1, 1, '2025-08-12 00:02:23'),
(779, 394, 29, NULL, 34.00, 'OK', NULL, '2025-08-12 02:04:11', '2025-08-12 02:04:18', 1, 1, '2025-08-12 00:04:18'),
(780, 394, 6, NULL, 66.00, 'OK', NULL, '2025-08-12 02:17:04', '2025-08-12 02:17:08', 1, 1, '2025-08-12 00:17:08'),
(781, 395, 3, NULL, 99.00, 'OK', NULL, '2025-08-12 02:17:26', '2025-08-12 02:17:28', 1, 1, '2025-08-12 00:17:28'),
(782, 397, 3, NULL, 99.00, 'OK', NULL, '2025-08-12 02:23:48', '2025-08-12 02:35:54', 1, 1, '2025-08-12 00:35:54'),
(784, 397, 6, NULL, 99.00, 'OK', NULL, '2025-08-12 02:24:41', '2025-08-12 02:24:43', 1, 1, '2025-08-12 00:24:43'),
(785, 428, 29, NULL, 44.00, 'OK', NULL, '2025-08-12 02:27:53', '2025-08-12 02:28:01', 1, 1, '2025-08-12 00:28:01'),
(786, 393, 3, NULL, 99.00, 'OK', NULL, '2025-08-12 02:28:22', '2025-08-12 02:28:23', 1, 1, '2025-08-12 00:28:23'),
(787, 433, 3, NULL, 2.00, 'OK', NULL, '2025-08-12 02:31:32', '2025-08-12 02:31:33', 1, 1, '2025-08-12 00:31:33'),
(788, 412, 6, NULL, 99.00, 'OK', NULL, '2025-08-12 02:34:11', '2025-08-12 02:34:22', 1, 1, '2025-08-12 00:34:22'),
(789, 412, 3, NULL, 88.00, 'OK', NULL, '2025-08-12 02:34:15', '2025-08-12 02:34:22', 1, 1, '2025-08-12 00:34:22'),
(790, 395, 29, NULL, 45.00, 'OK', NULL, '2025-08-12 02:36:11', '2025-08-12 02:36:44', 1, 1, '2025-08-12 00:36:44'),
(791, 395, 6, NULL, 98.00, 'OK', NULL, '2025-08-12 02:36:23', '2025-08-12 02:36:44', 1, 1, '2025-08-12 00:36:44'),
(792, 426, 29, NULL, 99.00, 'OK', NULL, '2025-08-12 02:52:05', '2025-08-12 04:07:18', 1, 1, '2025-08-12 02:07:18'),
(793, 393, 29, NULL, 12.00, 'OK', NULL, '2025-08-12 02:52:20', '2025-08-12 02:52:28', 1, 1, '2025-08-12 00:52:28'),
(795, 411, 3, NULL, 43.00, 'OK', NULL, '2025-08-12 03:53:44', '2025-08-12 03:53:45', 1, 1, '2025-08-12 01:53:45'),
(799, 433, 6, NULL, 99.00, 'OK', NULL, '2025-08-12 04:06:26', '2025-08-12 04:06:31', 1, 1, '2025-08-12 02:06:31'),
(800, 433, 29, NULL, 99.00, 'OK', NULL, '2025-08-12 04:06:29', '2025-08-12 04:06:31', 1, 1, '2025-08-12 02:06:31'),
(801, 426, 3, NULL, 99.00, 'OK', NULL, '2025-08-12 04:06:47', '2025-08-12 04:07:18', 1, 1, '2025-08-12 02:07:18'),
(802, 426, 6, NULL, 85.00, 'OK', NULL, '2025-08-12 04:06:51', '2025-08-12 04:06:53', 1, 1, '2025-08-12 02:06:53'),
(804, 464, 1, NULL, 73.00, 'OK', NULL, '2025-08-12 04:21:28', '2025-08-12 04:21:50', 1, 1, '2025-08-12 02:21:50'),
(805, 465, 1, NULL, 81.00, 'OK', NULL, '2025-08-12 04:21:42', '2025-08-12 04:21:52', 1, 1, '2025-08-12 02:21:52'),
(806, 466, 6, NULL, 74.00, 'OK', NULL, '2025-08-12 04:22:43', '2025-08-12 04:22:54', 1, 1, '2025-08-12 02:22:54'),
(807, 467, 3, NULL, 78.00, 'OK', NULL, '2025-08-12 04:23:22', '2025-08-12 04:23:34', 1, 1, '2025-08-12 02:23:34'),
(808, 467, 29, NULL, 87.00, 'OK', NULL, '2025-08-12 04:23:25', '2025-08-12 04:23:34', 1, 1, '2025-08-12 02:23:34'),
(809, 468, 6, NULL, 55.00, 'OK', NULL, '2025-08-12 04:32:43', '2025-08-12 04:33:07', 1, 1, '2025-08-12 02:33:07'),
(810, 469, 29, NULL, NULL, 'OK', NULL, '2025-08-12 04:32:48', '2025-08-12 04:33:08', 1, 1, '2025-08-12 02:33:08'),
(811, 469, 29, NULL, 55.00, 'OK', NULL, '2025-08-12 04:32:48', '2025-08-15 14:34:54', 0, 1, '2025-08-12 02:33:08'),
(812, 470, 29, NULL, 77.00, 'OK', NULL, '2025-08-12 04:32:56', '2025-08-12 04:33:09', 1, 1, '2025-08-12 02:33:09'),
(813, 471, 6, NULL, 88.00, 'OK', NULL, '2025-08-12 04:33:00', '2025-08-12 04:33:10', 1, 1, '2025-08-12 02:33:10'),
(814, 472, 29, NULL, 78.00, 'OK', NULL, '2025-08-12 04:33:03', '2025-08-12 04:33:10', 1, 1, '2025-08-12 02:33:10'),
(815, 473, 1, NULL, 81.00, 'OK', NULL, '2025-08-12 04:33:44', '2025-08-12 04:33:49', 1, 1, '2025-08-12 02:33:49'),
(817, 425, 1, NULL, 72.00, 'OK', NULL, '2025-08-14 11:53:48', '2025-08-14 11:53:48', 0, NULL, NULL),
(818, 466, 1, NULL, 58.00, 'OK', NULL, '2025-08-15 12:31:14', '2025-08-15 14:18:50', 1, 1, '2025-08-15 11:13:57'),
(819, 467, 1, NULL, 68.00, 'OK', '{\"Rotation\":{},\"Direction\":{},\"Axis\":{},\"Grab\":{},\"Feature\":{},\"Rail\":{}}', '2025-08-15 12:33:21', '2025-08-15 12:33:21', 0, NULL, NULL),
(820, 468, 1, NULL, 66.00, 'OK', '{\"Rotation\":[\"1620\"],\"Direction\":[\"Backside\"],\"Axis\":[\"Double Cork\"],\"Grab\":[\"Nose\"],\"Feature\":[\"Kicker\"],\"Rail\":[\"Boardslide\"]}', '2025-08-15 12:35:28', '2025-08-15 13:13:54', 1, 1, '2025-08-15 11:13:54'),
(821, 469, 1, NULL, 68.00, 'OK', '{\"Rotation\":[\"900\"],\"Direction\":[\"Backside\"],\"Axis\":[\"Triple Cork\"],\"Grab\":[],\"Feature\":[],\"Rail\":[]}', '2025-08-15 12:39:52', '2025-08-15 13:13:52', 1, 1, '2025-08-15 11:13:52'),
(822, 470, 1, NULL, 79.00, 'OK', NULL, '2025-08-15 12:41:11', '2025-08-15 14:34:34', 0, 1, '2025-08-15 11:00:41'),
(823, 401, 29, NULL, 45.00, 'OK', '{\"Rotation\":[\"540\"],\"Direction\":[\"Frontside\"],\"Axis\":[\"Double Cork\"],\"Grab\":[\"Tail\"],\"Feature\":[\"Rail\"],\"Rail\":[\"270 Out\"]}', '2025-08-15 13:15:38', '2025-08-15 17:02:39', 1, 1, '2025-08-15 15:02:39'),
(824, 436, 29, NULL, 55.00, 'OK', NULL, '2025-08-15 13:34:13', '2025-08-15 17:04:25', 1, 1, '2025-08-15 12:20:19'),
(825, 436, 3, NULL, 44.00, 'OK', NULL, '2025-08-15 14:15:19', '2025-08-15 14:19:02', 1, 1, '2025-08-15 12:16:30'),
(826, 475, 1, NULL, 43.00, 'OK', '{\"Rotation\":[\"360\"],\"Direction\":[\"Frontside\",\"Backside\"],\"Grab\":[\"Mute\"],\"Feature\":[\"Kicker\"]}', '2025-08-15 16:06:13', '2025-08-16 03:18:23', 1, 1, '2025-08-16 01:18:23'),
(827, 476, 29, NULL, 55.00, 'OK', '{\"Rotation\":[\"540\"],\"Direction\":[\"Backside\"],\"Grab\":[\"Indy\"],\"Feature\":[\"Box\"]}', '2025-08-15 16:47:19', '2025-08-15 16:47:25', 1, 1, '2025-08-15 14:47:25'),
(828, 476, 1, NULL, 67.00, 'OK', '{\"figures\":{\"Direction\":[\"Switch FS\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755299299275,\"run_number\":\"3\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 01:08:23', '2025-08-16 01:08:23', 0, NULL, NULL),
(829, 477, 1, NULL, 65.00, 'OK', '{\"figures\":{\"Direction\":[\"Switch FS\",\"Backside\"],\"Rotation\":[\"540\",\"720\"],\"Axis\":[\"Flat\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755299371261,\"run_number\":\"3\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 01:09:33', '2025-08-16 01:09:33', 0, NULL, NULL),
(830, 478, 1, NULL, 55.00, 'OK', '{\"figures\":{\"Rotation\":[\"540\"],\"Direction\":[\"Backside\"],\"Axis\":[\"Flat\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755307161188,\"run_number\":\"manual_edit\",\"client_validated\":true,\"diversity_rules_checked\":0}}', '2025-08-16 01:10:44', '2025-08-16 03:19:33', 0, NULL, NULL),
(831, 387, NULL, NULL, 33.00, '', NULL, '2025-08-16 22:25:26', '2025-08-16 22:25:26', 0, NULL, NULL),
(832, 449, NULL, NULL, 61.50, '', NULL, '2025-08-16 22:29:24', '2025-08-16 22:29:24', 0, NULL, NULL),
(833, 471, 1, NULL, 72.00, 'OK', '{\"figures\":{},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755376199575,\"run_number\":\"2\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 22:30:01', '2025-08-16 22:30:01', 0, NULL, NULL),
(834, 450, NULL, NULL, 51.50, '', NULL, '2025-08-16 22:33:48', '2025-08-16 22:33:48', 0, NULL, NULL),
(835, 472, 1, NULL, 76.00, 'OK', '{\"figures\":{\"Rotation\":[\"180\"],\"Direction\":[\"Backside\"],\"Axis\":[\"Flat\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755376486870,\"run_number\":\"2\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 22:34:48', '2025-08-16 22:34:48', 0, NULL, NULL),
(836, 479, 1, NULL, 87.00, 'OK', '{\"figures\":{\"Rotation\":[\"360\"],\"Direction\":[\"Backside\"],\"Axis\":[\"Cork\"],\"Grab\":[\"Nose\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755376609230,\"run_number\":\"2\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 22:36:58', '2025-08-16 22:36:58', 0, NULL, NULL),
(837, 480, 1, NULL, 69.00, 'OK', '{\"figures\":{\"Rotation\":[\"360\"],\"Direction\":[\"Frontside\"],\"Axis\":[\"Double Cork\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755378318251,\"run_number\":\"3\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 23:05:19', '2025-08-16 23:05:19', 0, NULL, NULL),
(838, 481, 1, NULL, 52.00, 'OK', '{\"figures\":{\"Rotation\":[\"180\"],\"Direction\":[\"Frontside\"],\"Axis\":[\"Double Cork\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755378578282,\"run_number\":\"3\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 23:09:39', '2025-08-16 23:09:39', 0, NULL, NULL),
(839, 444, NULL, NULL, 38.00, '', NULL, '2025-08-16 23:11:44', '2025-08-16 23:11:44', 0, NULL, NULL),
(840, 482, 1, NULL, 75.00, 'OK', '{\"figures\":{\"Rotation\":[\"180\"],\"Direction\":[\"Frontside\"],\"Axis\":[\"Flat\"],\"Grab\":[\"Mute\"],\"Feature\":[\"Kicker\"],\"Rail\":[\"Boardslide\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755378741515,\"run_number\":\"2\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 23:12:23', '2025-08-16 23:12:23', 0, NULL, NULL),
(841, 483, 1, NULL, 92.00, 'OK', '{\"figures\":{\"Direction\":[\"Backside\"],\"Rotation\":[\"360\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755380229431,\"run_number\":\"3\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-16 23:37:10', '2025-08-16 23:37:10', 0, NULL, NULL),
(842, 484, 1, NULL, 47.00, 'OK', '{\"figures\":{\"Rotation\":[\"720\"],\"Axis\":[\"Double Cork\"],\"Direction\":[\"Backside\"]},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755382888004,\"run_number\":\"2\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-17 00:21:35', '2025-08-17 00:21:35', 0, NULL, NULL),
(843, 485, 1, NULL, 75.00, 'OK', '{\"figures\":{},\"validation\":{\"diversity_valid\":true,\"validation_timestamp\":1755386935475,\"run_number\":\"3\",\"client_validated\":true,\"diversity_rules_checked\":2}}', '2025-08-17 01:28:59', '2025-08-17 01:28:59', 0, NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `scoring_formats`
--

CREATE TABLE `scoring_formats` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `name` varchar(255) NOT NULL,
  `sport` varchar(100) NOT NULL,
  `mode` varchar(100) NOT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_formats`
--

INSERT INTO `scoring_formats` (`id`, `format_id`, `name`, `sport`, `mode`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'Snowboard – Slopestyle (Sections+OI)', 'snowboard', 'sections_plus_oi', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(2, 'snowboard_halfpipe_best_run', 'Snowboard – Halfpipe (Best Run)', 'snowboard', 'best_run', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(3, 'snowboard_big_air_best_two', 'Snowboard – Big Air (Best 2)', 'snowboard', 'attempts_best_n', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(4, 'freeski_slopestyle_sections_oi', 'Freeski – Slopestyle (Sections+OI)', 'freeski', 'sections_plus_oi', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(5, 'freeski_halfpipe_best_run', 'Freeski – Halfpipe (Best Run)', 'freeski', 'best_run', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(6, 'freeski_big_air_best_two', 'Freeski – Big Air (Best 2)', 'freeski', 'attempts_best_n', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(7, 'skate_street_hybrid', 'Skateboarding – Street (Runs + Tricks)', 'skateboard', 'runs_plus_tricks', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(8, 'skate_park_runs', 'Skateboarding – Park (Best Run)', 'skateboard', 'best_run', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(9, 'bmx_freestyle_park', 'BMX Freestyle – Park', 'bmx', 'best_vs_avg', 1, '2025-08-15 04:20:17', '2025-08-15 22:16:33'),
(10, 'inline_roller_freestyle', 'Inline – Roller Freestyle', 'inline', 'best_run', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(11, 'wake_cable_features_air', 'Wakeboard – Cable (Features + Air)', 'wakeboard', 'best_run', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(12, 'surf_two_best_waves', 'Surf – Best Two Waves', 'surf', 'attempts_best_n', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(13, 'kitesurf_freestyle_tricks', 'Kitesurf – Freestyle (Best N + OI)', 'kitesurf', 'attempts_best_n_plus_oi', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(14, 'kitesurf_big_air', 'Kitesurf – Big Air (Best 3)', 'kitesurf', 'attempts_best_n', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(15, 'parkour_freestyle_fig', 'Parkour – Freestyle (FIG)', 'parkour', 'components_ED', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17'),
(16, 'breaking_wdsf_comparative', 'Breaking – WDSF Comparative', 'breaking', 'comparative', 1, '2025-08-15 04:20:17', '2025-08-15 04:20:17');

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_criteria`
--

CREATE TABLE `scoring_format_criteria` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `criteria_type` varchar(50) NOT NULL,
  `criteria_name` varchar(255) NOT NULL,
  `sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_criteria`
--

INSERT INTO `scoring_format_criteria` (`id`, `format_id`, `criteria_type`, `criteria_name`, `sort_order`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'sections', 'Amplitude', 0),
(2, 'snowboard_slopestyle_sections_oi', 'sections', 'Difficulty', 1),
(3, 'snowboard_slopestyle_sections_oi', 'sections', 'Execution', 2),
(4, 'snowboard_slopestyle_sections_oi', 'sections', 'Variety', 3),
(5, 'snowboard_slopestyle_sections_oi', 'oi', 'Progression', 0),
(6, 'snowboard_slopestyle_sections_oi', 'oi', 'Use of Course', 1),
(7, 'snowboard_slopestyle_sections_oi', 'oi', 'Execution', 2),
(8, 'snowboard_slopestyle_sections_oi', 'oi', 'Difficulty', 3),
(9, 'snowboard_halfpipe_best_run', 'oi', 'Difficulty', 0),
(10, 'snowboard_halfpipe_best_run', 'oi', 'Execution', 1),
(11, 'snowboard_halfpipe_best_run', 'oi', 'Amplitude', 2),
(12, 'snowboard_halfpipe_best_run', 'oi', 'Variety', 3),
(13, 'snowboard_halfpipe_best_run', 'oi', 'Progression', 4),
(14, 'snowboard_halfpipe_best_run', 'oi', 'Use of Pipe', 5),
(15, 'snowboard_big_air_best_two', 'attempt', 'Difficulty', 0),
(16, 'snowboard_big_air_best_two', 'attempt', 'Execution', 1),
(17, 'snowboard_big_air_best_two', 'attempt', 'Amplitude', 2),
(18, 'snowboard_big_air_best_two', 'attempt', 'Landing', 3),
(19, 'snowboard_big_air_best_two', 'attempt', 'Variety', 4),
(20, 'snowboard_big_air_best_two', 'attempt', 'Progression', 5),
(21, 'freeski_slopestyle_sections_oi', 'sections', 'Amplitude', 0),
(22, 'freeski_slopestyle_sections_oi', 'sections', 'Difficulty', 1),
(23, 'freeski_slopestyle_sections_oi', 'sections', 'Execution', 2),
(24, 'freeski_slopestyle_sections_oi', 'sections', 'Variety', 3),
(25, 'freeski_slopestyle_sections_oi', 'oi', 'Progression', 0),
(26, 'freeski_slopestyle_sections_oi', 'oi', 'Use of Course', 1),
(27, 'freeski_slopestyle_sections_oi', 'oi', 'Execution', 2),
(28, 'freeski_slopestyle_sections_oi', 'oi', 'Difficulty', 3),
(29, 'freeski_halfpipe_best_run', 'oi', 'Difficulty', 0),
(30, 'freeski_halfpipe_best_run', 'oi', 'Execution', 1),
(31, 'freeski_halfpipe_best_run', 'oi', 'Amplitude', 2),
(32, 'freeski_halfpipe_best_run', 'oi', 'Variety', 3),
(33, 'freeski_halfpipe_best_run', 'oi', 'Progression', 4),
(34, 'freeski_halfpipe_best_run', 'oi', 'Use of Pipe', 5),
(35, 'freeski_big_air_best_two', 'attempt', 'Difficulty', 0),
(36, 'freeski_big_air_best_two', 'attempt', 'Execution', 1),
(37, 'freeski_big_air_best_two', 'attempt', 'Amplitude', 2),
(38, 'freeski_big_air_best_two', 'attempt', 'Landing', 3),
(39, 'freeski_big_air_best_two', 'attempt', 'Variety', 4),
(40, 'freeski_big_air_best_two', 'attempt', 'Progression', 5),
(41, 'skate_street_hybrid', 'oi', 'Difficulty', 0),
(42, 'skate_street_hybrid', 'oi', 'Execution', 1),
(43, 'skate_street_hybrid', 'oi', 'Variety', 2),
(44, 'skate_street_hybrid', 'oi', 'Amplitude', 3),
(45, 'skate_street_hybrid', 'oi', 'Flow', 4),
(46, 'skate_street_hybrid', 'oi', 'Use of Course', 5),
(47, 'skate_park_runs', 'oi', 'Difficulty', 0),
(48, 'skate_park_runs', 'oi', 'Execution', 1),
(49, 'skate_park_runs', 'oi', 'Variety', 2),
(50, 'skate_park_runs', 'oi', 'Amplitude', 3),
(51, 'skate_park_runs', 'oi', 'Flow', 4),
(52, 'skate_park_runs', 'oi', 'Use of Park', 5),
(53, 'bmx_freestyle_park', 'oi', 'Difficulty', 0),
(54, 'bmx_freestyle_park', 'oi', 'Progression', 1),
(55, 'bmx_freestyle_park', 'oi', 'Variety', 2),
(56, 'bmx_freestyle_park', 'oi', 'Creativity', 3),
(57, 'bmx_freestyle_park', 'oi', 'Execution', 4),
(58, 'bmx_freestyle_park', 'oi', 'Amplitude', 5),
(59, 'bmx_freestyle_park', 'oi', 'Flow', 6),
(60, 'bmx_freestyle_park', 'oi', 'Use of Course', 7),
(61, 'bmx_freestyle_park', 'oi', 'Risk', 8),
(62, 'bmx_freestyle_park', 'oi', 'Style', 9),
(63, 'inline_roller_freestyle', 'oi', 'Difficulty', 0),
(64, 'inline_roller_freestyle', 'oi', 'Execution', 1),
(65, 'inline_roller_freestyle', 'oi', 'Amplitude', 2),
(66, 'inline_roller_freestyle', 'oi', 'Flow', 3),
(67, 'inline_roller_freestyle', 'oi', 'Variety', 4),
(68, 'wake_cable_features_air', 'oi', 'Composition/Variety', 0),
(69, 'wake_cable_features_air', 'oi', 'Intensity', 1),
(70, 'wake_cable_features_air', 'oi', 'Execution', 2),
(71, 'wake_cable_features_air', 'oi', 'Features vs Air Balance', 3),
(72, 'surf_two_best_waves', 'attempt', 'Commitment', 0),
(73, 'surf_two_best_waves', 'attempt', 'Innovation', 1),
(74, 'surf_two_best_waves', 'attempt', 'Combo/Variety', 2),
(75, 'surf_two_best_waves', 'attempt', 'Speed/Power/Flow', 3),
(76, 'kitesurf_freestyle_tricks', 'attempt', 'Height/Extremity', 0),
(77, 'kitesurf_freestyle_tricks', 'attempt', 'Technicality', 1),
(78, 'kitesurf_freestyle_tricks', 'attempt', 'Variety', 2),
(79, 'kitesurf_freestyle_tricks', 'attempt', 'Innovation', 3),
(80, 'kitesurf_freestyle_tricks', 'attempt', 'Smoothness', 4),
(81, 'kitesurf_freestyle_tricks', 'attempt', 'Commitment', 5),
(82, 'kitesurf_freestyle_tricks', 'oi', 'Overall Impression', 0),
(83, 'kitesurf_big_air', 'attempt', 'Height', 0),
(84, 'kitesurf_big_air', 'attempt', 'Extremity', 1),
(85, 'kitesurf_big_air', 'attempt', 'Technicality', 2),
(86, 'kitesurf_big_air', 'attempt', 'Control', 3),
(87, 'kitesurf_big_air', 'attempt', 'Variety', 4),
(88, 'parkour_freestyle_fig', 'E', 'Safety/Landings', 0),
(89, 'parkour_freestyle_fig', 'E', 'Flow', 1),
(90, 'parkour_freestyle_fig', 'E', 'Quality', 2),
(91, 'parkour_freestyle_fig', 'D', 'Difficulty via elements table', 0),
(92, 'breaking_wdsf_comparative', 'comparative', 'Technique', 0),
(93, 'breaking_wdsf_comparative', 'comparative', 'Vocabulary', 0),
(94, 'breaking_wdsf_comparative', 'comparative', 'Originality', 0),
(95, 'breaking_wdsf_comparative', 'comparative', 'Execution', 0),
(96, 'breaking_wdsf_comparative', 'comparative', 'Musicality', 0);

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_diversity_rules`
--

CREATE TABLE `scoring_format_diversity_rules` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `rule_type` varchar(100) NOT NULL,
  `scope` varchar(100) DEFAULT NULL,
  `group_name` varchar(100) DEFAULT NULL,
  `min_distinct` int(11) DEFAULT NULL,
  `is_optional` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_diversity_rules`
--

INSERT INTO `scoring_format_diversity_rules` (`id`, `format_id`, `rule_type`, `scope`, `group_name`, `min_distinct`, `is_optional`) VALUES
(1, 'snowboard_big_air_best_two', 'requireDistinct', 'attempts', 'Direction', 2, 0),
(2, 'snowboard_big_air_best_two', 'requireDistinct', 'attempts', 'Rotation', 2, 0),
(3, 'freeski_big_air_best_two', 'requireDistinct', 'attempts', 'Direction', 2, 0),
(4, 'freeski_big_air_best_two', 'requireDistinct', 'attempts', 'Rotation', 2, 0),
(5, 'kitesurf_big_air', 'requireDistinct', 'attempts', 'Jump', 3, 0),
(6, 'kitesurf_freestyle_tricks', 'requireDistinct', 'attempts', 'Jump', 2, 1),
(7, 'kitesurf_freestyle_tricks', 'requireDistinct', 'attempts', 'Style', 2, 1),
(8, 'skate_street_hybrid', 'tricksDistinctGroups', 'tricks', 'Flip', 2, 0),
(9, 'skate_street_hybrid', 'tricksDistinctGroups', 'tricks', 'Grind/Slide', 2, 0),
(10, 'skate_street_hybrid', 'tricksDistinctGroups', 'tricks', 'Gap', 2, 0),
(11, 'surf_two_best_waves', 'anyPass', NULL, 'Wave', 2, 0),
(12, 'surf_two_best_waves', 'anyPass', NULL, 'Maneuver', 2, 0);

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_flow`
--

CREATE TABLE `scoring_format_flow` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `flow_stage` varchar(255) NOT NULL,
  `sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_flow`
--

INSERT INTO `scoring_format_flow` (`id`, `format_id`, `flow_stage`, `sort_order`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'Qualification', 0),
(2, 'snowboard_slopestyle_sections_oi', 'Final', 1),
(3, 'snowboard_halfpipe_best_run', 'Qualification', 0),
(4, 'snowboard_halfpipe_best_run', 'Final', 1),
(5, 'snowboard_big_air_best_two', 'Qualification', 0),
(6, 'snowboard_big_air_best_two', 'Final', 1),
(7, 'freeski_slopestyle_sections_oi', 'Qualification', 0),
(8, 'freeski_slopestyle_sections_oi', 'Final', 1),
(9, 'freeski_halfpipe_best_run', 'Qualification', 0),
(10, 'freeski_halfpipe_best_run', 'Final', 1),
(11, 'freeski_big_air_best_two', 'Qualification', 0),
(12, 'freeski_big_air_best_two', 'Final', 1),
(13, 'skate_street_hybrid', 'Qualification', 0),
(14, 'skate_street_hybrid', 'Final', 1),
(15, 'skate_park_runs', 'Qualification', 0),
(16, 'skate_park_runs', 'Final', 1),
(17, 'bmx_freestyle_park', 'Qualification', 0),
(18, 'bmx_freestyle_park', 'Final', 1),
(19, 'inline_roller_freestyle', 'Qualification', 0),
(20, 'inline_roller_freestyle', 'Final', 1),
(21, 'wake_cable_features_air', 'Qualification', 0),
(22, 'wake_cable_features_air', 'Final', 1),
(23, 'surf_two_best_waves', 'Heats', 0),
(24, 'surf_two_best_waves', 'Elimination', 1),
(25, 'surf_two_best_waves', 'Final', 2),
(26, 'kitesurf_freestyle_tricks', 'Heats', 0),
(27, 'kitesurf_freestyle_tricks', 'Quarters', 1),
(28, 'kitesurf_freestyle_tricks', 'Semis', 2),
(29, 'kitesurf_freestyle_tricks', 'Final', 3),
(30, 'kitesurf_big_air', 'Heats', 0),
(31, 'kitesurf_big_air', 'Quarters', 1),
(32, 'kitesurf_big_air', 'Semis', 2),
(33, 'kitesurf_big_air', 'Final', 3),
(34, 'parkour_freestyle_fig', 'Qualification', 0),
(35, 'parkour_freestyle_fig', 'Final', 1),
(36, 'breaking_wdsf_comparative', 'Top 16', 0),
(37, 'breaking_wdsf_comparative', 'Quarters', 1),
(38, 'breaking_wdsf_comparative', 'Semis', 2),
(39, 'breaking_wdsf_comparative', 'Final', 3);

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_judges`
--

CREATE TABLE `scoring_format_judges` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `min_judges` int(11) NOT NULL DEFAULT 5,
  `max_judges` int(11) DEFAULT NULL,
  `scale_min` decimal(5,2) DEFAULT 0.00,
  `scale_max` decimal(5,2) DEFAULT 100.00,
  `scale_type` varchar(50) DEFAULT 'numeric',
  `scale_custom` text DEFAULT NULL,
  `precision_decimal` int(11) DEFAULT 0,
  `drop_rule` varchar(100) DEFAULT 'none'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_judges`
--

INSERT INTO `scoring_format_judges` (`id`, `format_id`, `min_judges`, `max_judges`, `scale_min`, `scale_max`, `scale_type`, `scale_custom`, `precision_decimal`, `drop_rule`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 5, 7, 0.00, 100.00, 'numeric', NULL, 0, 'none'),
(2, 'snowboard_halfpipe_best_run', 6, 7, 0.00, 100.00, 'numeric', NULL, 0, 'drop high/low'),
(3, 'snowboard_big_air_best_two', 5, 7, 0.00, 100.00, 'numeric', NULL, 0, 'drop high/low'),
(4, 'freeski_slopestyle_sections_oi', 5, 7, 0.00, 100.00, 'numeric', NULL, 0, 'none'),
(5, 'freeski_halfpipe_best_run', 6, 7, 0.00, 100.00, 'numeric', NULL, 0, 'drop high/low'),
(6, 'freeski_big_air_best_two', 5, 7, 0.00, 100.00, 'numeric', NULL, 0, 'drop high/low'),
(7, 'skate_street_hybrid', 5, 5, 0.00, 100.00, 'numeric', NULL, 0, 'drop high/low'),
(8, 'skate_park_runs', 5, 5, 0.00, 100.00, 'numeric', NULL, 0, 'drop high/low'),
(9, 'bmx_freestyle_park', 5, 7, 0.00, 100.00, 'numeric', NULL, 0, 'none'),
(10, 'inline_roller_freestyle', 5, 5, 0.00, 100.00, 'numeric', NULL, 0, 'none'),
(11, 'wake_cable_features_air', 5, 5, 0.00, 100.00, 'numeric', NULL, 0, 'none'),
(12, 'surf_two_best_waves', 5, 5, 0.00, 10.00, 'numeric', NULL, 1, 'drop high/low per wave'),
(13, 'kitesurf_freestyle_tricks', 5, 5, 0.00, 10.00, 'numeric', NULL, 1, 'drop high/low per trick'),
(14, 'kitesurf_big_air', 5, 5, 0.00, 10.00, 'numeric', NULL, 1, 'drop high/low per trick'),
(15, 'parkour_freestyle_fig', 6, 6, NULL, NULL, 'custom', 'E 0–15 + D open', 0, 'components'),
(16, 'breaking_wdsf_comparative', 5, 9, NULL, NULL, 'custom', 'comparative', 0, 'n/a');

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_mode_config`
--

CREATE TABLE `scoring_format_mode_config` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `config_type` varchar(50) NOT NULL,
  `config_key` varchar(100) NOT NULL,
  `config_value` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_mode_config`
--

INSERT INTO `scoring_format_mode_config` (`id`, `format_id`, `config_type`, `config_key`, `config_value`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'sections', 'count', '6'),
(2, 'snowboard_slopestyle_sections_oi', 'sections', 'weight', '0.6'),
(3, 'snowboard_slopestyle_sections_oi', 'oi', 'weight', '0.4'),
(4, 'snowboard_big_air_best_two', 'attempts', 'max', '3'),
(5, 'snowboard_big_air_best_two', 'attempts', 'bestN', '2'),
(6, 'snowboard_big_air_best_two', 'attempts', 'diversity', 'different tricks/dirs'),
(7, 'freeski_slopestyle_sections_oi', 'sections', 'count', '6'),
(8, 'freeski_slopestyle_sections_oi', 'sections', 'weight', '0.6'),
(9, 'freeski_slopestyle_sections_oi', 'oi', 'weight', '0.4'),
(10, 'freeski_big_air_best_two', 'attempts', 'max', '3'),
(11, 'freeski_big_air_best_two', 'attempts', 'bestN', '2'),
(12, 'freeski_big_air_best_two', 'attempts', 'diversity', 'different tricks/dirs'),
(13, 'skate_street_hybrid', 'runs', 'perRound', '2'),
(14, 'skate_street_hybrid', 'tricks', 'attempts', '5'),
(15, 'skate_street_hybrid', 'tricks', 'bestN', '2'),
(16, 'surf_two_best_waves', 'attempts', 'max', '12'),
(17, 'surf_two_best_waves', 'attempts', 'bestN', '2'),
(18, 'kitesurf_freestyle_tricks', 'oi', 'weight', '0.2'),
(19, 'kitesurf_freestyle_tricks', 'attempts', 'max', '7'),
(20, 'kitesurf_freestyle_tricks', 'attempts', 'bestN', '4'),
(21, 'kitesurf_big_air', 'attempts', 'max', '8'),
(22, 'kitesurf_big_air', 'attempts', 'bestN', '3');

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_results`
--

CREATE TABLE `scoring_format_results` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `header_name` varchar(255) NOT NULL,
  `sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_results`
--

INSERT INTO `scoring_format_results` (`id`, `format_id`, `header_name`, `sort_order`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'Rank', 0),
(2, 'snowboard_slopestyle_sections_oi', 'Bib', 1),
(3, 'snowboard_slopestyle_sections_oi', 'Name', 2),
(4, 'snowboard_slopestyle_sections_oi', 'Run 1', 3),
(5, 'snowboard_slopestyle_sections_oi', 'Run 2', 4),
(6, 'snowboard_slopestyle_sections_oi', 'Best', 5),
(7, 'snowboard_slopestyle_sections_oi', 'Sections (Σ)', 6),
(8, 'snowboard_slopestyle_sections_oi', 'OI', 7),
(9, 'snowboard_slopestyle_sections_oi', 'Total', 8),
(10, 'snowboard_halfpipe_best_run', 'Rank', 0),
(11, 'snowboard_halfpipe_best_run', 'Bib', 1),
(12, 'snowboard_halfpipe_best_run', 'Name', 2),
(13, 'snowboard_halfpipe_best_run', 'Run 1', 3),
(14, 'snowboard_halfpipe_best_run', 'Run 2', 4),
(15, 'snowboard_halfpipe_best_run', 'Run 3', 5),
(16, 'snowboard_halfpipe_best_run', 'Best', 6),
(17, 'snowboard_big_air_best_two', 'Rank', 0),
(18, 'snowboard_big_air_best_two', 'Bib', 1),
(19, 'snowboard_big_air_best_two', 'Name', 2),
(20, 'snowboard_big_air_best_two', 'Jump 1', 3),
(21, 'snowboard_big_air_best_two', 'Jump 2', 4),
(22, 'snowboard_big_air_best_two', 'Jump 3', 5),
(23, 'snowboard_big_air_best_two', 'Best Two', 6),
(24, 'snowboard_big_air_best_two', 'Total', 7),
(25, 'freeski_slopestyle_sections_oi', 'Rank', 0),
(26, 'freeski_slopestyle_sections_oi', 'Bib', 1),
(27, 'freeski_slopestyle_sections_oi', 'Name', 2),
(28, 'freeski_slopestyle_sections_oi', 'Run 1', 3),
(29, 'freeski_slopestyle_sections_oi', 'Run 2', 4),
(30, 'freeski_slopestyle_sections_oi', 'Best', 5),
(31, 'freeski_slopestyle_sections_oi', 'Sections (Σ)', 6),
(32, 'freeski_slopestyle_sections_oi', 'OI', 7),
(33, 'freeski_slopestyle_sections_oi', 'Total', 8),
(34, 'freeski_halfpipe_best_run', 'Rank', 0),
(35, 'freeski_halfpipe_best_run', 'Bib', 1),
(36, 'freeski_halfpipe_best_run', 'Name', 2),
(37, 'freeski_halfpipe_best_run', 'Run 1', 3),
(38, 'freeski_halfpipe_best_run', 'Run 2', 4),
(39, 'freeski_halfpipe_best_run', 'Run 3', 5),
(40, 'freeski_halfpipe_best_run', 'Best', 6),
(41, 'freeski_big_air_best_two', 'Rank', 0),
(42, 'freeski_big_air_best_two', 'Bib', 1),
(43, 'freeski_big_air_best_two', 'Name', 2),
(44, 'freeski_big_air_best_two', 'Jump 1', 3),
(45, 'freeski_big_air_best_two', 'Jump 2', 4),
(46, 'freeski_big_air_best_two', 'Jump 3', 5),
(47, 'freeski_big_air_best_two', 'Best Two', 6),
(48, 'freeski_big_air_best_two', 'Total', 7),
(49, 'skate_street_hybrid', 'Rank', 0),
(50, 'skate_street_hybrid', 'Bib', 1),
(51, 'skate_street_hybrid', 'Name', 2),
(52, 'skate_street_hybrid', 'Run 1', 3),
(53, 'skate_street_hybrid', 'Run 2', 4),
(54, 'skate_street_hybrid', 'Best Run', 5),
(55, 'skate_street_hybrid', 'Best Tricks (×2)', 6),
(56, 'skate_street_hybrid', 'Total', 7),
(57, 'skate_park_runs', 'Rank', 0),
(58, 'skate_park_runs', 'Bib', 1),
(59, 'skate_park_runs', 'Name', 2),
(60, 'skate_park_runs', 'Run 1', 3),
(61, 'skate_park_runs', 'Run 2', 4),
(62, 'skate_park_runs', 'Run 3', 5),
(63, 'skate_park_runs', 'Best', 6),
(64, 'bmx_freestyle_park', 'Rank', 0),
(65, 'bmx_freestyle_park', 'Bib', 1),
(66, 'bmx_freestyle_park', 'Name', 2),
(67, 'bmx_freestyle_park', 'Run 1', 3),
(68, 'bmx_freestyle_park', 'Run 2', 4),
(69, 'bmx_freestyle_park', 'Average/Best', 5),
(70, 'bmx_freestyle_park', 'Total', 6),
(71, 'inline_roller_freestyle', 'Rank', 0),
(72, 'inline_roller_freestyle', 'Bib', 1),
(73, 'inline_roller_freestyle', 'Name', 2),
(74, 'inline_roller_freestyle', 'Run 1', 3),
(75, 'inline_roller_freestyle', 'Run 2', 4),
(76, 'inline_roller_freestyle', 'Best', 5),
(77, 'wake_cable_features_air', 'Rank', 0),
(78, 'wake_cable_features_air', 'Bib', 1),
(79, 'wake_cable_features_air', 'Name', 2),
(80, 'wake_cable_features_air', 'Run 1', 3),
(81, 'wake_cable_features_air', 'Run 2', 4),
(82, 'wake_cable_features_air', 'Best', 5),
(83, 'surf_two_best_waves', 'Rank', 0),
(84, 'surf_two_best_waves', 'Name', 1),
(85, 'surf_two_best_waves', 'Wave 1', 2),
(86, 'surf_two_best_waves', 'Wave 2', 3),
(87, 'surf_two_best_waves', 'Wave 3', 4),
(88, 'surf_two_best_waves', '…', 5),
(89, 'surf_two_best_waves', 'Best Two', 6),
(90, 'surf_two_best_waves', 'Total /20', 7),
(91, 'kitesurf_freestyle_tricks', 'Rank', 0),
(92, 'kitesurf_freestyle_tricks', 'Name', 1),
(93, 'kitesurf_freestyle_tricks', 'Trick Attempts', 2),
(94, 'kitesurf_freestyle_tricks', 'Best 4', 3),
(95, 'kitesurf_freestyle_tricks', 'OI', 4),
(96, 'kitesurf_freestyle_tricks', 'Total', 5),
(97, 'kitesurf_big_air', 'Rank', 0),
(98, 'kitesurf_big_air', 'Name', 1),
(99, 'kitesurf_big_air', 'Jump Attempts', 2),
(100, 'kitesurf_big_air', 'Best 3', 3),
(101, 'kitesurf_big_air', 'Total', 4),
(102, 'parkour_freestyle_fig', 'Rank', 0),
(103, 'parkour_freestyle_fig', 'Name', 1),
(104, 'parkour_freestyle_fig', 'E total', 2),
(105, 'parkour_freestyle_fig', 'D1', 3),
(106, 'parkour_freestyle_fig', 'D2', 4),
(107, 'parkour_freestyle_fig', 'D3', 5),
(108, 'parkour_freestyle_fig', 'Ded.', 6),
(109, 'parkour_freestyle_fig', 'Final', 7),
(110, 'breaking_wdsf_comparative', 'Battle', 0),
(111, 'breaking_wdsf_comparative', 'Bboy/Bgirl A', 1),
(112, 'breaking_wdsf_comparative', 'Bboy/Bgirl B', 2),
(113, 'breaking_wdsf_comparative', 'Technique', 3),
(114, 'breaking_wdsf_comparative', 'Vocabulary', 4),
(115, 'breaking_wdsf_comparative', 'Originality', 5),
(116, 'breaking_wdsf_comparative', 'Execution', 6),
(117, 'breaking_wdsf_comparative', 'Musicality', 7),
(118, 'breaking_wdsf_comparative', 'Winner', 8);

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_rounds`
--

CREATE TABLE `scoring_format_rounds` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `round_name` varchar(100) NOT NULL,
  `runs` int(11) DEFAULT 0,
  `aggregation` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_rounds`
--

INSERT INTO `scoring_format_rounds` (`id`, `format_id`, `round_name`, `runs`, `aggregation`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'qualifying', 2, 'best run'),
(2, 'snowboard_slopestyle_sections_oi', 'final', 3, 'best run'),
(3, 'snowboard_halfpipe_best_run', 'qualifying', 2, 'best'),
(4, 'snowboard_halfpipe_best_run', 'final', 3, 'best'),
(5, 'snowboard_big_air_best_two', 'qualifying', 3, 'best 2 of 3'),
(6, 'snowboard_big_air_best_two', 'final', 3, 'best 2 of 3'),
(7, 'freeski_slopestyle_sections_oi', 'qualifying', 2, 'best'),
(8, 'freeski_slopestyle_sections_oi', 'final', 3, 'best'),
(9, 'freeski_halfpipe_best_run', 'qualifying', 2, 'best'),
(10, 'freeski_halfpipe_best_run', 'final', 3, 'best'),
(11, 'freeski_big_air_best_two', 'qualifying', 3, 'best 2 of 3'),
(12, 'freeski_big_air_best_two', 'final', 3, 'best 2 of 3'),
(13, 'skate_street_hybrid', 'qualifying', 2, 'best run + best 2 tricks'),
(14, 'skate_street_hybrid', 'final', 2, 'best run + best 2 tricks'),
(15, 'skate_park_runs', 'qualifying', 3, 'best'),
(16, 'skate_park_runs', 'final', 3, 'best'),
(17, 'bmx_freestyle_park', 'qualifying', 2, 'average of 2'),
(18, 'bmx_freestyle_park', 'final', 2, 'best 1'),
(19, 'inline_roller_freestyle', 'qualifying', 2, 'best'),
(20, 'inline_roller_freestyle', 'final', 2, 'best'),
(21, 'wake_cable_features_air', 'qualifying', 2, 'best'),
(22, 'wake_cable_features_air', 'final', 2, 'best'),
(23, 'surf_two_best_waves', 'heat', 3, 'sum best 2 waves'),
(24, 'kitesurf_freestyle_tricks', 'heat', 8, 'sum best 4 + OI(20%)'),
(25, 'kitesurf_big_air', 'heat', 8, 'sum best 3'),
(26, 'parkour_freestyle_fig', 'qualifying', 1, 'E + top3 D - ded.'),
(27, 'parkour_freestyle_fig', 'final', 1, 'E + top3 D - ded.'),
(28, 'breaking_wdsf_comparative', 'battle', 1, 'majority of criteria');

-- --------------------------------------------------------

--
-- Table structure for table `scoring_format_tiebreak`
--

CREATE TABLE `scoring_format_tiebreak` (
  `id` int(11) NOT NULL,
  `format_id` varchar(100) NOT NULL,
  `tiebreak_rule` varchar(255) NOT NULL,
  `sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `scoring_format_tiebreak`
--

INSERT INTO `scoring_format_tiebreak` (`id`, `format_id`, `tiebreak_rule`, `sort_order`) VALUES
(1, 'snowboard_slopestyle_sections_oi', 'higher section total', 0),
(2, 'snowboard_slopestyle_sections_oi', 'higher OI', 1),
(3, 'snowboard_slopestyle_sections_oi', 'HJ vote', 2),
(4, 'snowboard_halfpipe_best_run', '2nd best run', 0),
(5, 'snowboard_halfpipe_best_run', '3rd best run', 1),
(6, 'snowboard_halfpipe_best_run', 'HJ vote', 2),
(7, 'snowboard_big_air_best_two', 'highest jump', 0),
(8, 'snowboard_big_air_best_two', '2nd highest', 1),
(9, 'snowboard_big_air_best_two', 'HJ vote', 2),
(10, 'freeski_slopestyle_sections_oi', 'higher section total', 0),
(11, 'freeski_slopestyle_sections_oi', 'higher OI', 1),
(12, 'freeski_slopestyle_sections_oi', 'HJ vote', 2),
(13, 'freeski_halfpipe_best_run', '2nd best run', 0),
(14, 'freeski_halfpipe_best_run', '3rd best run', 1),
(15, 'freeski_halfpipe_best_run', 'HJ vote', 2),
(16, 'freeski_big_air_best_two', 'highest jump', 0),
(17, 'freeski_big_air_best_two', '2nd highest', 1),
(18, 'freeski_big_air_best_two', 'HJ vote', 2),
(19, 'skate_street_hybrid', 'best run', 0),
(20, 'skate_street_hybrid', 'best trick', 1),
(21, 'skate_street_hybrid', 'HJ vote', 2),
(22, 'skate_park_runs', '2nd best run', 0),
(23, 'skate_park_runs', '3rd best run', 1),
(24, 'skate_park_runs', 'HJ vote', 2),
(25, 'bmx_freestyle_park', 'highest single run', 0),
(26, 'bmx_freestyle_park', 'HJ vote', 1),
(27, 'inline_roller_freestyle', '2nd best run', 0),
(28, 'inline_roller_freestyle', 'HJ vote', 1),
(29, 'wake_cable_features_air', 'highest single run', 0),
(30, 'wake_cable_features_air', 'HJ vote', 1),
(31, 'surf_two_best_waves', 'highest wave', 0),
(32, 'surf_two_best_waves', '2nd highest', 1),
(33, 'surf_two_best_waves', '3rd highest', 2),
(34, 'kitesurf_freestyle_tricks', 'highest trick', 0),
(35, 'kitesurf_freestyle_tricks', '2nd highest', 1),
(36, 'kitesurf_freestyle_tricks', 'variety idx', 2),
(37, 'kitesurf_big_air', 'highest trick', 0),
(38, 'kitesurf_big_air', '2nd highest', 1),
(39, 'parkour_freestyle_fig', 'higher E', 0),
(40, 'parkour_freestyle_fig', 'higher D element', 1),
(41, 'parkour_freestyle_fig', 'HJ vote', 2),
(42, 'breaking_wdsf_comparative', 'additional round', 0),
(43, 'breaking_wdsf_comparative', 'HJ decision', 1);

-- --------------------------------------------------------

--
-- Table structure for table `token_actions`
--

CREATE TABLE `token_actions` (
  `id` int(11) NOT NULL,
  `action_name` varchar(100) NOT NULL,
  `action_description` text DEFAULT NULL,
  `token_cost` decimal(8,2) NOT NULL,
  `category` varchar(50) DEFAULT 'general',
  `is_active` tinyint(1) DEFAULT 1,
  `code_snippet` text DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `token_actions`
--

INSERT INTO `token_actions` (`id`, `action_name`, `action_description`, `token_cost`, `category`, `is_active`, `code_snippet`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 'add_participant', 'Add new participant to event', 1.00, 'participants', 1, 'TokenSystem::charge(\'add_participant\', $user_id, [\'participant_id\' => $participant_id]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(2, 'add_judge', 'Add new judge to system', 5.00, 'judges', 1, 'TokenSystem::charge(\'add_judge\', $user_id, [\'judge_id\' => $judge_id]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(3, 'create_event', 'Create new event', 30.00, 'events', 1, 'TokenSystem::charge(\'create_event\', $user_id, [\'event_id\' => $event_id]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(4, 'generate_pdf', 'Generate PDF report/certificate', 40.00, 'reports', 1, 'TokenSystem::charge(\'generate_pdf\', $user_id, [\'document_type\' => $type]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(5, 'send_email', 'Send email notification', 0.50, 'communications', 1, 'TokenSystem::charge(\'send_email\', $user_id, [\'recipient\' => $email]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(6, 'sms_notification', 'Send SMS notification', 2.00, 'communications', 1, 'TokenSystem::charge(\'sms_notification\', $user_id, [\'phone\' => $phone]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(7, 'live_streaming', 'Enable live streaming for event', 100.00, 'premium', 1, 'TokenSystem::charge(\'live_streaming\', $user_id, [\'event_id\' => $event_id]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(8, 'custom_branding', 'Apply custom branding to event', 50.00, 'premium', 1, 'TokenSystem::charge(\'custom_branding\', $user_id, [\'event_id\' => $event_id]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(9, 'export_data', 'Export event data (CSV/Excel)', 10.00, 'reports', 1, 'TokenSystem::charge(\'export_data\', $user_id, [\'format\' => $format]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(10, 'api_call', 'External API integration call', 0.10, 'integrations', 1, 'TokenSystem::charge(\'api_call\', $user_id, [\'api_service\' => $service]);', NULL, '2025-08-16 02:01:42', '2025-08-16 02:01:42');

-- --------------------------------------------------------

--
-- Table structure for table `token_packages`
--

CREATE TABLE `token_packages` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `token_amount` decimal(10,2) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `currency` varchar(3) DEFAULT 'USD',
  `bonus_tokens` decimal(8,2) DEFAULT 0.00,
  `is_active` tinyint(1) DEFAULT 1,
  `sort_order` int(11) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `token_packages`
--

INSERT INTO `token_packages` (`id`, `name`, `description`, `token_amount`, `price`, `currency`, `bonus_tokens`, `is_active`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 'Starter Pack', 'Perfect for small events', 100.00, 19.99, 'USD', 0.00, 1, 1, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(2, 'Professional Pack', 'Great for regular organizers', 500.00, 89.99, 'USD', 50.00, 1, 2, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(3, 'Enterprise Pack', 'For large organizations', 1500.00, 249.99, 'USD', 200.00, 1, 3, '2025-08-16 02:01:42', '2025-08-16 02:01:42'),
(4, 'Premium Pack', 'Maximum value package', 3000.00, 449.99, 'USD', 500.00, 1, 4, '2025-08-16 02:01:42', '2025-08-16 02:01:42');

-- --------------------------------------------------------

--
-- Table structure for table `token_transactions`
--

CREATE TABLE `token_transactions` (
  `id` int(11) NOT NULL,
  `budget_id` int(11) NOT NULL,
  `action_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `transaction_type` enum('debit','credit','purchase','refund') NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `balance_before` decimal(10,2) NOT NULL,
  `balance_after` decimal(10,2) NOT NULL,
  `description` text DEFAULT NULL,
  `reference_id` varchar(100) DEFAULT NULL,
  `reference_type` varchar(50) DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(50) DEFAULT NULL,
  `first_name` varchar(100) DEFAULT NULL,
  `last_name` varchar(100) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `role` enum('super_admin','admin','judge','head_judge','office','media','participant') DEFAULT 'participant',
  `judge_id` int(11) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `last_login` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `first_name`, `last_name`, `password`, `role`, `judge_id`, `created_at`, `last_login`) VALUES
(1, 'admin', NULL, NULL, 'admin123', 'admin', 1, '2025-08-06 15:23:21', NULL),
(3, 'judge2', NULL, NULL, 'judgepass', 'judge', NULL, '2025-08-06 15:23:21', NULL),
(6, 'karolina_6', NULL, NULL, 'judge275', 'judge', NULL, '2025-08-06 15:23:21', NULL),
(8, 'Łukasz_gasienica_8', NULL, NULL, 'judge642', 'judge', 8, '2025-08-06 15:23:21', NULL),
(14, 'admin_14', NULL, NULL, 'judge640', 'judge', 14, '2025-08-06 15:23:21', NULL),
(23, 'sprzęt_dj_ski', NULL, NULL, 'judge866', 'judge', 0, '2025-08-06 15:23:21', NULL),
(29, 'miksery', NULL, NULL, 'judge197', 'judge', 1, '2025-08-06 15:23:21', NULL),
(30, 'eskes', NULL, NULL, 'judge162', 'judge', 1, '2025-08-06 15:23:21', NULL),
(31, 'piatek', NULL, NULL, 'judge103', 'judge', 1, '2025-08-06 15:23:31', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `user_groups`
--

CREATE TABLE `user_groups` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `color` varchar(7) DEFAULT '#007bff',
  `is_active` tinyint(1) DEFAULT 1,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `budget_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_groups`
--

INSERT INTO `user_groups` (`id`, `name`, `description`, `color`, `is_active`, `created_by`, `created_at`, `updated_at`, `budget_id`) VALUES
(1, 'Default Judges', 'Default group for all judges', '#28a745', 1, NULL, '2025-08-16 01:34:19', '2025-08-16 01:34:19', NULL),
(2, 'Event Organizers', 'Users who can create and manage events', '#fd7e14', 1, NULL, '2025-08-16 01:34:19', '2025-08-16 01:34:19', NULL),
(3, 'Media Team', 'Media personnel with access to photos/videos', '#6f42c1', 1, NULL, '2025-08-16 01:34:19', '2025-08-16 01:34:19', NULL),
(4, 'Office Staff', 'Administrative office personnel', '#20c997', 1, NULL, '2025-08-16 01:34:19', '2025-08-16 01:34:19', NULL),
(5, 'VIP Access', 'Special access group for VIP users', '#ffc107', 1, NULL, '2025-08-16 01:34:19', '2025-08-16 01:34:19', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `user_group_memberships`
--

CREATE TABLE `user_group_memberships` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `role_in_group` enum('member','manager','owner') DEFAULT 'member',
  `joined_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_permissions`
--

CREATE TABLE `user_permissions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `permission` varchar(100) NOT NULL,
  `granted_by` int(11) DEFAULT NULL,
  `granted_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `expires_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_permissions`
--

INSERT INTO `user_permissions` (`id`, `user_id`, `permission`, `granted_by`, `granted_at`, `expires_at`) VALUES
(1, 1, 'login', 1, '2025-08-16 01:34:19', NULL),
(2, 3, 'login', 1, '2025-08-16 01:34:19', NULL),
(3, 6, 'login', 1, '2025-08-16 01:34:19', NULL),
(4, 8, 'login', 1, '2025-08-16 01:34:19', NULL),
(5, 14, 'login', 1, '2025-08-16 01:34:19', NULL),
(6, 23, 'login', 1, '2025-08-16 01:34:19', NULL),
(7, 29, 'login', 1, '2025-08-16 01:34:19', NULL),
(8, 30, 'login', 1, '2025-08-16 01:34:19', NULL),
(9, 31, 'login', 1, '2025-08-16 01:34:19', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `user_profiles`
--

CREATE TABLE `user_profiles` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `full_name` varchar(255) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `emergency_contact` varchar(255) DEFAULT NULL,
  `emergency_phone` varchar(50) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_profiles`
--

INSERT INTO `user_profiles` (`id`, `user_id`, `full_name`, `email`, `phone`, `address`, `emergency_contact`, `emergency_phone`, `notes`, `avatar`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 1, 'Admin', 'admin@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(2, 3, 'Judge2', 'judge2@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(3, 6, 'Karolina 6', 'karolina_6@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(4, 8, 'Łukasz Gasienica 8', 'Łukasz_gasienica_8@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(5, 14, 'Admin 14', 'admin_14@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(6, 23, 'Sprzęt Dj Ski', 'sprzęt_dj_ski@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(7, 29, 'Miksery', 'miksery@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(8, 30, 'Eskes', 'eskes@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05'),
(9, 31, 'Piatek', 'piatek@example.com', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2025-08-16 01:39:05', '2025-08-16 01:39:05');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `bib_assignments`
--
ALTER TABLE `bib_assignments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `event_id` (`event_id`,`bib_number`),
  ADD UNIQUE KEY `event_id_2` (`event_id`,`participant_id`);

--
-- Indexes for table `bib_series`
--
ALTER TABLE `bib_series`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `budgets`
--
ALTER TABLE `budgets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `group_id` (`group_id`),
  ADD KEY `idx_budgets_group_id` (`group_id`);

--
-- Indexes for table `events`
--
ALTER TABLE `events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_group_id` (`owner_group_id`);

--
-- Indexes for table `event_categories`
--
ALTER TABLE `event_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_event_categories_event_id` (`event_id`);

--
-- Indexes for table `event_control_points`
--
ALTER TABLE `event_control_points`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_event_control_points_event_id` (`event_id`),
  ADD KEY `idx_event_control_points_sort_order` (`sort_order`);

--
-- Indexes for table `event_heat_settings`
--
ALTER TABLE `event_heat_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `event_id` (`event_id`,`heat_number`),
  ADD KEY `ix_event_heat__flow_source_heat` (`flow_source_heat`),
  ADD KEY `idx_event_heat_discipline` (`discipline`),
  ADD KEY `idx_event_heat_difficulty` (`difficulty_level`),
  ADD KEY `idx_event_heat_scoring` (`scoring_method`),
  ADD KEY `idx_event_heat_weather` (`weather_dependent`);

--
-- Indexes for table `event_notifications`
--
ALTER TABLE `event_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_event_created` (`event_id`,`created_at`),
  ADD KEY `idx_event_id` (`event_id`),
  ADD KEY `idx_category` (`category`),
  ADD KEY `idx_event_category` (`event_id`,`category`);

--
-- Indexes for table `event_participants`
--
ALTER TABLE `event_participants`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `event_id` (`event_id`,`heat_number`,`participant_id`),
  ADD UNIQUE KEY `unique_assignment` (`event_id`,`heat_number`,`participant_id`),
  ADD KEY `participant_id` (`participant_id`),
  ADD KEY `category_id` (`category_id`);

--
-- Indexes for table `figure_categories`
--
ALTER TABLE `figure_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_sport_category` (`sport_name`,`category_name`);

--
-- Indexes for table `figure_items`
--
ALTER TABLE `figure_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_sport_category` (`sport_name`,`category_name`);

--
-- Indexes for table `figure_sports`
--
ALTER TABLE `figure_sports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sport_name` (`sport_name`);

--
-- Indexes for table `group_event_access`
--
ALTER TABLE `group_event_access`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_group_event` (`group_id`,`event_id`),
  ADD KEY `granted_by` (`granted_by`),
  ADD KEY `idx_group_event_access_group` (`group_id`),
  ADD KEY `idx_group_event_access_event` (`event_id`);

--
-- Indexes for table `judges`
--
ALTER TABLE `judges`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `judge_assignments`
--
ALTER TABLE `judge_assignments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `judge_assignments_ibfk_2` (`judge_id`),
  ADD KEY `judge_assignments_control_point_fk` (`control_point_id`),
  ADD KEY `ix_ja_event_judge_heat` (`event_id`,`judge_id`,`heat_number`),
  ADD KEY `ix_ja_cp` (`event_control_point_id`);

--
-- Indexes for table `participants`
--
ALTER TABLE `participants`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `participants_event`
--
ALTER TABLE `participants_event`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_participant_event` (`participant_id`,`event_id`),
  ADD KEY `event_id` (`event_id`);

--
-- Indexes for table `result_configurations`
--
ALTER TABLE `result_configurations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_event_view` (`event_id`,`view_type`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_order` (`display_order`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `result_styling`
--
ALTER TABLE `result_styling`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_event_config` (`event_id`,`config_id`);

--
-- Indexes for table `runs`
--
ALTER TABLE `runs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `event_participant_id` (`event_participant_id`);

--
-- Indexes for table `scores`
--
ALTER TABLE `scores`
  ADD PRIMARY KEY (`id`),
  ADD KEY `run_id` (`run_id`),
  ADD KEY `idx_approved` (`is_approved`),
  ADD KEY `fk_scores_judge_id` (`judge_id`),
  ADD KEY `scores_approved_by_fk` (`approved_by`),
  ADD KEY `ix_scores_cp` (`control_point_id`),
  ADD KEY `idx_scores_control_point_id` (`control_point_id`);

--
-- Indexes for table `scoring_formats`
--
ALTER TABLE `scoring_formats`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_criteria`
--
ALTER TABLE `scoring_format_criteria`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_diversity_rules`
--
ALTER TABLE `scoring_format_diversity_rules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_flow`
--
ALTER TABLE `scoring_format_flow`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_judges`
--
ALTER TABLE `scoring_format_judges`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_mode_config`
--
ALTER TABLE `scoring_format_mode_config`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_config` (`format_id`,`config_type`,`config_key`);

--
-- Indexes for table `scoring_format_results`
--
ALTER TABLE `scoring_format_results`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_rounds`
--
ALTER TABLE `scoring_format_rounds`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `scoring_format_tiebreak`
--
ALTER TABLE `scoring_format_tiebreak`
  ADD PRIMARY KEY (`id`),
  ADD KEY `format_id` (`format_id`);

--
-- Indexes for table `token_actions`
--
ALTER TABLE `token_actions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `action_name` (`action_name`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `idx_token_actions_name` (`action_name`),
  ADD KEY `idx_token_actions_active` (`is_active`);

--
-- Indexes for table `token_packages`
--
ALTER TABLE `token_packages`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `token_transactions`
--
ALTER TABLE `token_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_token_transactions_budget_id` (`budget_id`),
  ADD KEY `idx_token_transactions_user_id` (`user_id`),
  ADD KEY `idx_token_transactions_created_at` (`created_at`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD KEY `judge_id` (`judge_id`);

--
-- Indexes for table `user_groups`
--
ALTER TABLE `user_groups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `budget_id` (`budget_id`);

--
-- Indexes for table `user_group_memberships`
--
ALTER TABLE `user_group_memberships`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_user_group` (`user_id`,`group_id`),
  ADD KEY `idx_group_memberships_user_id` (`user_id`),
  ADD KEY `idx_group_memberships_group_id` (`group_id`);

--
-- Indexes for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_user_permission` (`user_id`,`permission`),
  ADD KEY `granted_by` (`granted_by`),
  ADD KEY `idx_user_permissions_user` (`user_id`);

--
-- Indexes for table `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `idx_user_profiles_user_id` (`user_id`),
  ADD KEY `idx_user_profiles_email` (`email`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `bib_assignments`
--
ALTER TABLE `bib_assignments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=450;

--
-- AUTO_INCREMENT for table `bib_series`
--
ALTER TABLE `bib_series`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `budgets`
--
ALTER TABLE `budgets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `events`
--
ALTER TABLE `events`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `event_categories`
--
ALTER TABLE `event_categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `event_control_points`
--
ALTER TABLE `event_control_points`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `event_heat_settings`
--
ALTER TABLE `event_heat_settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=467;

--
-- AUTO_INCREMENT for table `event_notifications`
--
ALTER TABLE `event_notifications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `event_participants`
--
ALTER TABLE `event_participants`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2071;

--
-- AUTO_INCREMENT for table `figure_categories`
--
ALTER TABLE `figure_categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT for table `figure_items`
--
ALTER TABLE `figure_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=204;

--
-- AUTO_INCREMENT for table `figure_sports`
--
ALTER TABLE `figure_sports`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `group_event_access`
--
ALTER TABLE `group_event_access`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `judges`
--
ALTER TABLE `judges`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `judge_assignments`
--
ALTER TABLE `judge_assignments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=357;

--
-- AUTO_INCREMENT for table `participants`
--
ALTER TABLE `participants`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1368;

--
-- AUTO_INCREMENT for table `participants_event`
--
ALTER TABLE `participants_event`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=818;

--
-- AUTO_INCREMENT for table `result_configurations`
--
ALTER TABLE `result_configurations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT for table `result_styling`
--
ALTER TABLE `result_styling`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `runs`
--
ALTER TABLE `runs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=486;

--
-- AUTO_INCREMENT for table `scores`
--
ALTER TABLE `scores`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=844;

--
-- AUTO_INCREMENT for table `scoring_formats`
--
ALTER TABLE `scoring_formats`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `scoring_format_criteria`
--
ALTER TABLE `scoring_format_criteria`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=97;

--
-- AUTO_INCREMENT for table `scoring_format_diversity_rules`
--
ALTER TABLE `scoring_format_diversity_rules`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `scoring_format_flow`
--
ALTER TABLE `scoring_format_flow`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;

--
-- AUTO_INCREMENT for table `scoring_format_judges`
--
ALTER TABLE `scoring_format_judges`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `scoring_format_mode_config`
--
ALTER TABLE `scoring_format_mode_config`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `scoring_format_results`
--
ALTER TABLE `scoring_format_results`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=119;

--
-- AUTO_INCREMENT for table `scoring_format_rounds`
--
ALTER TABLE `scoring_format_rounds`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT for table `scoring_format_tiebreak`
--
ALTER TABLE `scoring_format_tiebreak`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;

--
-- AUTO_INCREMENT for table `token_actions`
--
ALTER TABLE `token_actions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `token_packages`
--
ALTER TABLE `token_packages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `token_transactions`
--
ALTER TABLE `token_transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT for table `user_groups`
--
ALTER TABLE `user_groups`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `user_group_memberships`
--
ALTER TABLE `user_group_memberships`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_permissions`
--
ALTER TABLE `user_permissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `user_profiles`
--
ALTER TABLE `user_profiles`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `budgets`
--
ALTER TABLE `budgets`
  ADD CONSTRAINT `budgets_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `events`
--
ALTER TABLE `events`
  ADD CONSTRAINT `events_ibfk_1` FOREIGN KEY (`owner_group_id`) REFERENCES `user_groups` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `event_categories`
--
ALTER TABLE `event_categories`
  ADD CONSTRAINT `event_categories_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `event_control_points`
--
ALTER TABLE `event_control_points`
  ADD CONSTRAINT `event_control_points_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `event_participants`
--
ALTER TABLE `event_participants`
  ADD CONSTRAINT `event_participants_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `event_participants_ibfk_2` FOREIGN KEY (`participant_id`) REFERENCES `participants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `event_participants_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `event_categories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `figure_categories`
--
ALTER TABLE `figure_categories`
  ADD CONSTRAINT `figure_categories_ibfk_1` FOREIGN KEY (`sport_name`) REFERENCES `figure_sports` (`sport_name`) ON DELETE CASCADE;

--
-- Constraints for table `figure_items`
--
ALTER TABLE `figure_items`
  ADD CONSTRAINT `figure_items_ibfk_1` FOREIGN KEY (`sport_name`) REFERENCES `figure_sports` (`sport_name`) ON DELETE CASCADE;

--
-- Constraints for table `group_event_access`
--
ALTER TABLE `group_event_access`
  ADD CONSTRAINT `group_event_access_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `group_event_access_ibfk_2` FOREIGN KEY (`granted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `judge_assignments`
--
ALTER TABLE `judge_assignments`
  ADD CONSTRAINT `fk_ja_event_control_point` FOREIGN KEY (`event_control_point_id`) REFERENCES `event_control_points` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_judge_assignments_judge_id` FOREIGN KEY (`judge_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `judge_assignments_control_point_fk` FOREIGN KEY (`control_point_id`) REFERENCES `event_control_points` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `judge_assignments_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `judge_assignments_ibfk_2` FOREIGN KEY (`judge_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `participants_event`
--
ALTER TABLE `participants_event`
  ADD CONSTRAINT `participants_event_ibfk_1` FOREIGN KEY (`participant_id`) REFERENCES `participants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `participants_event_ibfk_2` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `result_configurations`
--
ALTER TABLE `result_configurations`
  ADD CONSTRAINT `result_configurations_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `result_configurations_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `result_styling`
--
ALTER TABLE `result_styling`
  ADD CONSTRAINT `result_styling_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `runs`
--
ALTER TABLE `runs`
  ADD CONSTRAINT `runs_ibfk_1` FOREIGN KEY (`event_participant_id`) REFERENCES `event_participants` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `scores`
--
ALTER TABLE `scores`
  ADD CONSTRAINT `fk_scores_event_cp` FOREIGN KEY (`control_point_id`) REFERENCES `event_control_points` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_scores_judge_id` FOREIGN KEY (`judge_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `scores_approved_by_fk` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `scores_ibfk_1` FOREIGN KEY (`run_id`) REFERENCES `runs` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_criteria`
--
ALTER TABLE `scoring_format_criteria`
  ADD CONSTRAINT `scoring_format_criteria_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_diversity_rules`
--
ALTER TABLE `scoring_format_diversity_rules`
  ADD CONSTRAINT `scoring_format_diversity_rules_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_flow`
--
ALTER TABLE `scoring_format_flow`
  ADD CONSTRAINT `scoring_format_flow_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_judges`
--
ALTER TABLE `scoring_format_judges`
  ADD CONSTRAINT `scoring_format_judges_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_mode_config`
--
ALTER TABLE `scoring_format_mode_config`
  ADD CONSTRAINT `scoring_format_mode_config_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_results`
--
ALTER TABLE `scoring_format_results`
  ADD CONSTRAINT `scoring_format_results_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_rounds`
--
ALTER TABLE `scoring_format_rounds`
  ADD CONSTRAINT `scoring_format_rounds_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `scoring_format_tiebreak`
--
ALTER TABLE `scoring_format_tiebreak`
  ADD CONSTRAINT `scoring_format_tiebreak_ibfk_1` FOREIGN KEY (`format_id`) REFERENCES `scoring_formats` (`format_id`) ON DELETE CASCADE;

--
-- Constraints for table `token_actions`
--
ALTER TABLE `token_actions`
  ADD CONSTRAINT `token_actions_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `user_groups`
--
ALTER TABLE `user_groups`
  ADD CONSTRAINT `user_groups_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `user_groups_ibfk_2` FOREIGN KEY (`budget_id`) REFERENCES `budgets` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `user_group_memberships`
--
ALTER TABLE `user_group_memberships`
  ADD CONSTRAINT `user_group_memberships_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `user_group_memberships_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`granted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD CONSTRAINT `user_profiles_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
