<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * completion_type 한글 값을 영문 코드로 변환
     */
    public function up(): void
    {
        DB::table('process_steps')
            ->where('completion_type', '클릭 시 완료')
            ->update(['completion_type' => 'click_complete']);

        DB::table('process_steps')
            ->where('completion_type', '선택 완료 시 완료')
            ->update(['completion_type' => 'selection_complete']);

        DB::table('process_steps')
            ->where('completion_type', '검사완료 시 완료')
            ->update(['completion_type' => 'inspection_complete']);
    }

    /**
     * 영문 코드를 한글 값으로 롤백
     */
    public function down(): void
    {
        DB::table('process_steps')
            ->where('completion_type', 'click_complete')
            ->update(['completion_type' => '클릭 시 완료']);

        DB::table('process_steps')
            ->where('completion_type', 'selection_complete')
            ->update(['completion_type' => '선택 완료 시 완료']);

        DB::table('process_steps')
            ->where('completion_type', 'inspection_complete')
            ->update(['completion_type' => '검사완료 시 완료']);
    }
};
