<?php

namespace Database\Factories;

use App\Models\Station;
use Illuminate\Database\Eloquent\Factories\Factory;

/** @extends Factory<Station> */
class StationFactory extends Factory
{
    public function definition(): array
    {
        $trading = 'Station ' . str()->random(8);

        return [
            'node_id'                        => (string) str()->ulid(),
            'trading_name'                   => $trading,
            'brand_name'                     => $trading,
            'is_same_trading_and_brand'      => true,
            'is_supermarket'                 => false,
            'is_motorway_service_station'    => false,
            'is_supermarket_service_station' => false,
            'temporary_closure'              => false,
            'permanent_closure'              => false,
            'permanent_closure_date'         => null,
            'public_phone_number'            => null,
            'address_line_1'                 => 'Address ' . str()->random(6),
            'address_line_2'                 => null,
            'city'                           => 'City ' . str()->random(6),
            'county'                         => null,
            'country'                        => 'England',
            'postcode'                       => strtoupper(str()->random(6)),
            'lat'                            => random_int(499, 609) / 10.0,
            'lng'                            => random_int(-82, 18) / 10.0,
            'amenities'                      => [],
            'opening_times'                  => null,
            'fuel_types'                     => ['E10', 'E5'],
            'last_seen_at'                   => now(),
        ];
    }

    public function supermarket(): static
    {
        return $this->state([
            'trading_name'   => 'Tesco',
            'brand_name'     => 'Tesco',
            'is_supermarket' => true,
        ]);
    }
}
