<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class DriverCustomArea extends Model
{
    protected $fillable = [
        'driver_id',
        'name',
        'boundaries',
        'center_lat',
        'center_lng',
        'is_active',
    ];

    protected $casts = [
        'boundaries' => 'array',
        'center_lat' => 'decimal:8',
        'center_lng' => 'decimal:8',
        'is_active' => 'boolean',
    ];

    public function driver(): BelongsTo
    {
        return $this->belongsTo(User::class, 'driver_id');
    }
}
