<?php

namespace App\Models;

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

class PersonalZurich extends Model
{
    protected $table = 'personal_zurich';

    protected $fillable = [
        'tenant_id',
        'codigo_sistema',
        'nombre',
        'cargo',
        'email',
        'telefono',
        'rol',
        'activo',
    ];

    protected $casts = [
        'activo' => 'boolean',
    ];

    public function tenant(): BelongsTo
    {
        return $this->belongsTo(Tenant::class);
    }

    public function casosComoEjecutivo(): HasMany
    {
        return $this->hasMany(Caso::class, 'ejecutivo_id');
    }

    public function casosComoDirector(): HasMany
    {
        return $this->hasMany(Caso::class, 'director_id');
    }

    public function casosComoReinspector(): HasMany
    {
        return $this->hasMany(Caso::class, 'reinspector_id');
    }
}
