<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class ExtendCandidateProfileFields extends Migration
{
    public function up(): void
    {
        $this->forge->addColumn('candidate_profiles', [
            'about' => ['type' => 'TEXT', 'null' => true, 'after' => 'headline'],
            'video_intro_url' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true, 'after' => 'about'],
            'current_salary' => ['type' => 'DECIMAL', 'constraint' => '12,2', 'null' => true, 'after' => 'salary_expectation_max'],
            'work_preference' => ['type' => 'ENUM', 'constraint' => ['remote', 'hybrid', 'onsite', 'any'], 'default' => 'any', 'after' => 'preferred_locations'],
            'preferred_employment_type' => ['type' => 'ENUM', 'constraint' => ['full_time', 'part_time', 'contract', 'internship', 'freelance', 'any'], 'default' => 'any'],
            'career_level' => ['type' => 'ENUM', 'constraint' => ['entry', 'mid', 'senior', 'lead', 'executive'], 'null' => true],
            'industry_preferences' => ['type' => 'JSON', 'null' => true],
            'is_verified' => ['type' => 'TINYINT', 'constraint' => 1, 'default' => 0],
        ]);
    }

    public function down(): void
    {
        $this->forge->dropColumn('candidate_profiles', [
            'about', 'video_intro_url', 'current_salary', 'work_preference',
            'preferred_employment_type', 'career_level', 'industry_preferences', 'is_verified',
        ]);
    }
}
