<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('criterias', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('description');
            $table->string('type');
            $table->timestamps();
        });

        // Insert init data
        DB::table('criterias')->insert([
            [
                'name' => 'Deadline',
                'description' => 'Is the sprint progressing on schedule?',
                'type' => 'SPRINT',
            ],
            [
                'name' => 'Story point',
                'description' => 'Is the sprint on track to complete the planned story points?',
                'type' => 'SPRINT',
            ],
            [
                'name' => 'Demo - Function',
                'description' => 'Did the features implemented in the sprint work well during the demo?',
                'type' => 'SPRINT',
            ],
            [
                'name' => 'Code quality',
                'description' => 'Did the code produce any bugs during testing?',
                'type' => 'SPRINT',
            ],
            [
                'name' => 'Level of task completion',
                'description' => 'Is the team member ensuring the task is completed on schedule?',
                'type' => 'MEMBER',
            ],
            [
                'name' => 'Code quality',
                'description' => 'Number of bugs arising from the team member\'s task',
                'type' => 'MEMBER',
            ],
        ]);
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('criterias');
    }
};
