CREATE TABLE IF NOT EXISTS `delivery_statuses` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `key` VARCHAR(50) NOT NULL,
    `label_pl` VARCHAR(100) NOT NULL,
    `color` VARCHAR(7) NOT NULL DEFAULT '#6c757d',
    `sort_order` TINYINT UNSIGNED NOT NULL DEFAULT 0,
    `is_terminal` TINYINT(1) NOT NULL DEFAULT 0,
    `is_system` TINYINT(1) NOT NULL DEFAULT 0,
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `delivery_statuses_key_unique` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `delivery_statuses` (`key`, `label_pl`, `color`, `sort_order`, `is_terminal`, `is_system`) VALUES
    ('unknown',           'Nieznany',               '#f5f5f5', 0,  0, 0),
    ('created',           'Utworzona',               '#e3f2fd', 1,  0, 0),
    ('confirmed',         'Potwierdzona',             '#bbdefb', 2,  0, 0),
    ('picked_up',         'Odebrana przez kuriera',   '#e1f5fe', 3,  0, 0),
    ('in_transit',        'W tranzycie',              '#fff3e0', 4,  0, 0),
    ('out_for_delivery',  'W doręczeniu',             '#ffe0b2', 5,  0, 0),
    ('ready_for_pickup',  'Gotowa do odbioru',        '#f3e5f5', 6,  0, 0),
    ('delivered',         'Doręczona',                '#e8f5e9', 7,  1, 1),
    ('returned',          'Zwrócona',                 '#ffebee', 8,  1, 1),
    ('cancelled',         'Anulowana',                '#e0e0e0', 9,  1, 1),
    ('problem',           'Problem',                  '#fff8e1', 10, 0, 0);
