<?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('cameras', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100);
            $table->string('location', 200)->nullable();
            $table->string('rtsp_url', 500);
            $table->string('snapshot_url', 500)->nullable()->comment('HTTP MJPEG or JPEG snapshot URL');
            $table->string('username', 100)->nullable();
            $table->string('password', 100)->nullable();
            $table->string('chainage', 20)->nullable();
            $table->string('highway', 100)->nullable();
            $table->decimal('latitude', 10, 6)->nullable();
            $table->decimal('longitude', 10, 6)->nullable();
            $table->text('notes')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });
    }

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