<?php

namespace App\Models;

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

class DeviceProfileMaster extends Model
{
    use HasFactory;

    protected $table = 'device_profile_master';

    protected $keyType = 'string';        // Treat ID as a string
    public $incrementing = false;         // Disable auto-incrementing

    protected $fillable = [
        'id',
        'name',
        'description',
    ];

    protected $casts = [
        'id' => 'string',
        
    ];


    public function devices()
    {
        return $this->hasMany(Device::class, 'device_profile_id', 'id');
    }

    public function timeseriesKeys()
    {
        return $this->hasMany(TimeseriesKeyMaster::class, 'device_profile_xid', 'id');
    }
}
