<?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('trading_symbols', function (Blueprint $table) {
            $table->id();
            $table->string('symbol')->unique();
            $table->string('display_name');
            $table->string('category');
            $table->string('base_currency')->nullable();
            $table->string('quote_currency');
            $table->decimal('contract_size', 15, 4);
            $table->decimal('pip_size', 15, 6);
            $table->decimal('default_price', 15, 6)->default(1);
            $table->boolean('is_active')->default(true);
            $table->timestamps();

            $table->index(['category', 'is_active']);
        });
    }

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