<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('song_library_cache', function (Blueprint $table) {
            $table->bigIncrements('song_id')->comment('歌曲編號'); 
            $table->string('song_name')->nullable()->index()->comment('歌曲檔名');
            $table->string('song_simplified')->nullable()->index()->comment('歌曲簡體');
            $table->string('phonetic_abbr')->nullable()->index()->comment('歌曲注音');
            $table->string('pinyin_abbr')->nullable()->index()->comment('歌曲拼音');
            $table->integer('strokes_abbr')->default(0)->index()->comment('歌曲筆劃');
            $table->integer('song_number')->default(0)->index()->comment('歌曲字數');
            $table->string('artistA')->nullable()->index()->comment('歌星名稱A');
            $table->string('artistB')->nullable()->index()->comment('歌星名稱B');
            $table->string('artistA_simplified')->nullable()->index()->comment('歌星簡體名稱A');
            $table->string('artistB_simplified')->nullable()->index()->comment('歌星簡體名稱B');
            $table->enum('artistA_category', ['未定義','男', '女','團','外', '其他'])->default('未定義')->index()->comment('歌星類別A');
            $table->enum('artistB_category', ['未定義','男', '女','團','外', '其他'])->default('未定義')->index()->comment('歌星類別B');
            $table->enum('artist_category', ['未定義','團'])->default('未定義')->index()->comment('歌星類別');
            $table->string('song_filename')->nullable()->comment('歌曲檔名');
            $table->string('song_category')->nullable()->comment('歌曲分類');
            $table->enum('language_name', ['未定義','國語','台語','英語','日語','粵語','韓語','越語','客語','其他'])->default('未定義')->index()->comment('語別');
            $table->date('add_date')->nullable()->index()->comment('新增日期');
            $table->enum('situation', ['未定義','浪漫', '柔和','動感','明亮'])->default('未定義')->index()->comment('情境');
            $table->tinyInteger('vocal')->index()->comment('人聲'); // 0,1
            $table->integer('db_change')->default(0)->index()->comment('DB加減');
            $table->integer('song_counts')->default(0)->index()->comment('點播次數');
            $table->dateTime('updated_at')->nullable();
        });
    }

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