<?php
/**
 * _             _       _
 * | |____      _| | __ _| |__
 * | '_ \ \ /\ / / |/ _` | '_ \
 * | |_) \ V  V /| | (_| | |_) |
 * |_.__/ \_/\_/ |_|\__,_|_.__/.
 *
 * @author    Bwlab di Luigi Massa <info@bwlab.it>
 * @copyright since 2014 Bwlab
 * @license   proprietary
 */

declare(strict_types=1);

if (!defined('_PS_VERSION_')) {
    exit;
}

return [
    'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'withdrawal_request` (
        `id_withdrawal_request` int(11) NOT NULL AUTO_INCREMENT,
        `id_order` int(11) NOT NULL,
        `id_customer` int(11) NOT NULL,
        `id_shop` int(11) NOT NULL DEFAULT 1,
        `customer_name` varchar(255) NOT NULL,
        `customer_email` varchar(255) NOT NULL,
        `order_reference` varchar(9) NOT NULL,
        `status` varchar(30) NOT NULL DEFAULT \'pending\',
        `notes` text DEFAULT NULL,
        `user_agent` varchar(512) NOT NULL DEFAULT \'\',
        `withdrawal_deadline` datetime NOT NULL,
        `date_add` datetime NOT NULL,
        `date_upd` datetime NOT NULL,
        `id_employee` int(11) DEFAULT NULL,
        PRIMARY KEY (`id_withdrawal_request`),
        KEY `idx_id_order` (`id_order`),
        KEY `idx_id_customer` (`id_customer`),
        KEY `idx_status` (`status`),
        KEY `idx_id_shop` (`id_shop`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci',

    'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'withdrawal_category_config` (
        `id_withdrawal_category_config` int(11) NOT NULL AUTO_INCREMENT,
        `id_category` int(11) NOT NULL,
        `id_shop` int(11) NOT NULL DEFAULT 1,
        `withdrawal_days` int(11) NOT NULL DEFAULT 14,
        `is_excluded` tinyint(1) NOT NULL DEFAULT 0,
        `date_add` datetime NOT NULL,
        `date_upd` datetime NOT NULL,
        PRIMARY KEY (`id_withdrawal_category_config`),
        UNIQUE KEY `uq_category_shop` (`id_category`, `id_shop`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci',
];
