<?php

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

/**
 * Çocuk/bebek yaş aralıkları tur seviyesinde (genel ayar) tanımlanır;
 * yeni tarih eklerken form bu değerlerle ön-dolar (tarih bazında override edilebilir).
 */
return new class extends Migration
{
    public function up(): void
    {
        foreach (['cultural_tours', 'international_tours'] as $tableName) {
            Schema::table($tableName, function (Blueprint $table) {
                $table->integer('child_min_age')->nullable()->after('max_age');
                $table->integer('child_max_age')->nullable()->after('child_min_age');
                $table->integer('infant_min_age')->nullable()->after('child_max_age');
                $table->integer('infant_max_age')->nullable()->after('infant_min_age');
            });
        }
    }

    public function down(): void
    {
        foreach (['cultural_tours', 'international_tours'] as $tableName) {
            Schema::table($tableName, function (Blueprint $table) {
                $table->dropColumn(['child_min_age', 'child_max_age', 'infant_min_age', 'infant_max_age']);
            });
        }
    }
};
