<?php

namespace App\Models;

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

class OpsProtocol extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'bastion_protocol_id',
        'description',
        'sort',
        'is_active',
    ];

    public function softwares(): HasMany
    {
        return $this->hasMany(OpsSoftware::class)->orderBy('sort')->orderBy('id');
    }

    protected function casts(): array
    {
        return [
            'is_active' => 'boolean',
        ];
    }
}
