CREATE TABLE IF NOT EXISTS `inpost_integration_settings` (
    `id` TINYINT UNSIGNED NOT NULL PRIMARY KEY,
    `api_token_encrypted` TEXT NULL,
    `organization_id` VARCHAR(50) NULL,
    `environment` ENUM('sandbox', 'production') NOT NULL DEFAULT 'sandbox',
    `default_dispatch_method` ENUM('pop', 'parcel_locker', 'courier') NOT NULL DEFAULT 'pop',
    `default_dispatch_point` VARCHAR(50) NULL,
    `default_insurance` DECIMAL(10, 2) NULL,
    `default_locker_size` ENUM('small', 'medium', 'large') NOT NULL DEFAULT 'small',
    `default_courier_length` SMALLINT UNSIGNED NULL DEFAULT 20,
    `default_courier_width` SMALLINT UNSIGNED NULL DEFAULT 15,
    `default_courier_height` SMALLINT UNSIGNED NULL DEFAULT 8,
    `label_format` ENUM('Pdf', 'Zpl', 'Epl') NOT NULL DEFAULT 'Pdf',
    `weekend_delivery` TINYINT(1) NOT NULL DEFAULT 0,
    `auto_insurance_value` TINYINT(1) NOT NULL DEFAULT 0,
    `multi_parcel` TINYINT(1) NOT NULL DEFAULT 0,
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `inpost_integration_settings` (`id`) VALUES (1)
ON DUPLICATE KEY UPDATE `updated_at` = NOW();
