<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class ZonasTable extends AbstractMigration
{
    public function change(): void
    {
        $table = $this->table('zonas');
        $table
            ->addColumn('nombre', 'string', ['limit' => 100])
            ->addColumn('centro_lat', 'decimal', ['precision' => 10, 'scale' => 7])
            ->addColumn('centro_lng', 'decimal', ['precision' => 10, 'scale' => 7])
            ->addColumn('radio_km', 'decimal', ['precision' => 6, 'scale' => 2])
            ->addColumn('tarifa_base', 'decimal', ['precision' => 10, 'scale' => 2])
            ->addColumn('tarifa_por_km', 'decimal', ['precision' => 10, 'scale' => 2])
            ->addColumn('recargo_hora_pico', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => 0])
            ->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
            ->addColumn('updated_at', 'timestamp', ['null' => true, 'update' => 'CURRENT_TIMESTAMP'])
            ->create();
    }
}
