<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Location extends Model
{
    use HasFactory;

    protected $table = 'locations'; // Nombre de la tabla

    protected $fillable = [
        'ampeco_location_id',
        'name',
        'address_en',
    ];

    protected $casts = [
        'ampeco_location_id' => 'integer',
    ];

    public function chargePoints()
    {
        return $this->hasMany(ChargePoint::class, 'location_id', 'ampeco_location_id');
    }
}
