<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('athletes', function (Blueprint $table) {
            $table->id();

            $table->foreignId('user_id')
                ->unique()
                ->constrained('users')
                ->cascadeOnDelete();

            $table->string('national_code', 10)->nullable()->unique();
            $table->string('photo_path')->nullable();
            $table->unsignedSmallInteger('height_cm')->nullable();

            // فقط "آخرین" وزن؛ تاریخچه واقعی در body_measurements (Phase 9) نگهداری می‌شود
            $table->decimal('weight_kg', 5, 2)->nullable();

            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('athletes');
    }
};
