-- Tabela spotkań franczyzodawca ↔ franczyzobiorcy
-- Iteracja 1: spotkania jednorazowe, statusy active / cancelled

CREATE TABLE IF NOT EXISTS `franchise_meeting` (
    `id`               INT            NOT NULL AUTO_INCREMENT,
    `title`            VARCHAR(255)   NOT NULL,
    `meeting_date`     DATE           NOT NULL,
    `meeting_time`     TIME           NOT NULL,
    `type`             ENUM('individual','group') NOT NULL,
    `agenda`           VARCHAR(255)   NOT NULL,
    `external_link`    VARCHAR(2048)  NULL,
    `duration_minutes` INT            NULL,
    `status`           ENUM('active','cancelled') NOT NULL DEFAULT 'active',
    -- dla spotkania indywidualnego; NULL oznacza spotkanie grupowe
    `id_shop`          INT            NULL,
    `created_by`       INT            NULL COMMENT 'id administratora tworzącego spotkanie',
    `created_at`       DATETIME       NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`       DATETIME       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    INDEX `idx_meeting_date`   (`meeting_date`),
    INDEX `idx_meeting_status` (`status`),
    INDEX `idx_meeting_shop`   (`id_shop`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
