"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateOnboardingTables1781060000000 = void 0;
class CreateOnboardingTables1781060000000 {
    constructor() {
        this.name = 'CreateOnboardingTables1781060000000';
    }
    async up(queryRunner) {
        await queryRunner.query(`
      CREATE TABLE IF NOT EXISTS \`onboarding_plans\` (
        \`id\` varchar(36) NOT NULL,
        \`name\` varchar(191) NOT NULL,
        \`description\` varchar(500) NOT NULL DEFAULT 'NT/APL',
        \`department_id\` varchar(191) NULL,
        \`is_default\` tinyint NOT NULL DEFAULT 0,
        \`status\` enum('active','inactive','deleted') NOT NULL DEFAULT 'active',
        \`owner_id\` varchar(191) NOT NULL,
        \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
        \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
        PRIMARY KEY (\`id\`),
        INDEX \`IDX_onboarding_plans_owner\` (\`owner_id\`)
      ) ENGINE=InnoDB
    `);
        await queryRunner.query(`
      CREATE TABLE IF NOT EXISTS \`onboarding_plan_tasks\` (
        \`id\` varchar(36) NOT NULL,
        \`plan_id\` varchar(191) NOT NULL,
        \`title\` varchar(191) NOT NULL,
        \`description\` text NULL,
        \`category\` enum('documentation','equipment','training','compliance','it_setup','hr') NOT NULL DEFAULT 'hr',
        \`assignee_type\` enum('hr','manager','new_hire','it') NOT NULL DEFAULT 'hr',
        \`due_offset_days\` int NOT NULL DEFAULT 0,
        \`sort_order\` int NOT NULL DEFAULT 0,
        \`is_required\` tinyint NOT NULL DEFAULT 1,
        \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
        \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
        PRIMARY KEY (\`id\`),
        INDEX \`IDX_onboarding_plan_tasks_plan\` (\`plan_id\`)
      ) ENGINE=InnoDB
    `);
        await queryRunner.query(`
      CREATE TABLE IF NOT EXISTS \`onboarding_records\` (
        \`id\` varchar(36) NOT NULL,
        \`application_id\` varchar(191) NULL,
        \`member_id\` varchar(191) NULL,
        \`job_posting_id\` varchar(191) NULL,
        \`plan_id\` varchar(191) NULL,
        \`status\` enum('not_started','in_progress','completed','cancelled') NOT NULL DEFAULT 'not_started',
        \`start_date\` datetime(3) NULL,
        \`target_completion_date\` datetime(3) NULL,
        \`completed_at\` datetime(3) NULL,
        \`candidate_snapshot\` json NULL,
        \`owner_id\` varchar(191) NOT NULL,
        \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
        \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
        PRIMARY KEY (\`id\`),
        INDEX \`IDX_onboarding_records_owner\` (\`owner_id\`),
        INDEX \`IDX_onboarding_records_application\` (\`application_id\`),
        INDEX \`IDX_onboarding_records_member\` (\`member_id\`)
      ) ENGINE=InnoDB
    `);
        await queryRunner.query(`
      CREATE TABLE IF NOT EXISTS \`onboarding_tasks\` (
        \`id\` varchar(36) NOT NULL,
        \`record_id\` varchar(191) NOT NULL,
        \`plan_task_id\` varchar(191) NULL,
        \`title\` varchar(191) NOT NULL,
        \`description\` text NULL,
        \`category\` enum('documentation','equipment','training','compliance','it_setup','hr') NOT NULL DEFAULT 'hr',
        \`assignee_type\` enum('hr','manager','new_hire','it') NOT NULL DEFAULT 'hr',
        \`assignee_member_id\` varchar(191) NULL,
        \`status\` enum('pending','in_progress','completed','skipped') NOT NULL DEFAULT 'pending',
        \`due_date\` datetime(3) NULL,
        \`completed_at\` datetime(3) NULL,
        \`notes\` text NULL,
        \`attachments\` json NULL,
        \`is_required\` tinyint NOT NULL DEFAULT 1,
        \`sort_order\` int NOT NULL DEFAULT 0,
        \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
        \`updated_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
        PRIMARY KEY (\`id\`),
        INDEX \`IDX_onboarding_tasks_record\` (\`record_id\`)
      ) ENGINE=InnoDB
    `);
    }
    async down(queryRunner) {
        await queryRunner.query('DROP TABLE IF EXISTS `onboarding_tasks`');
        await queryRunner.query('DROP TABLE IF EXISTS `onboarding_records`');
        await queryRunner.query('DROP TABLE IF EXISTS `onboarding_plan_tasks`');
        await queryRunner.query('DROP TABLE IF EXISTS `onboarding_plans`');
    }
}
exports.CreateOnboardingTables1781060000000 = CreateOnboardingTables1781060000000;
//# sourceMappingURL=1781060000000-CreateOnboardingTables.js.map