<?php

namespace App\Models;

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

class ChargePoint extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'ampeco_charge_point_id', // ¡Añadido!
        'location_id', // ¡Añadido!
        'name',                   // ¡Añadido!
        'access_type',            // ¡Añadido!
    ];

        /**
     * Get the location that the charge point belongs to.
     */
    public function location()
    {
        return $this->belongsTo(Location::class, 'location_id', 'ampeco_location_id');
    }
}