<?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('stations', function (Blueprint $table): void {
            $table->string('node_id', 64)->primary();
            $table->string('trading_name', 128);
            $table->string('brand_name', 64)->nullable();
            $table->boolean('is_same_trading_and_brand')->default(false);
            $table->boolean('is_supermarket')->default(false)->comment('Set by StationTaggingService');
            $table->boolean('is_motorway_service_station')->default(false);
            $table->boolean('is_supermarket_service_station')->default(false);
            $table->boolean('temporary_closure')->default(false);
            $table->boolean('permanent_closure')->default(false);
            $table->date('permanent_closure_date')->nullable();
            $table->string('public_phone_number', 20)->nullable();
            $table->string('address_line_1', 255)->nullable();
            $table->string('address_line_2', 255)->nullable();
            $table->string('city', 100)->nullable();
            $table->string('county', 100)->nullable();
            $table->string('country', 64)->nullable();
            $table->string('postcode', 10);
            $table->decimal('lat', 10, 7);
            $table->decimal('lng', 10, 7);
            $table->json('amenities')->nullable();
            $table->json('opening_times')->nullable();
            $table->json('fuel_types')->nullable();
            $table->dateTime('last_seen_at');
        });
    }

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