<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class Ajustador extends Authenticatable
{
    use Notifiable;

    protected $table = 'ajustadores';

    protected $fillable = [
        'tenant_id',
        'codigo_sistema',
        'nombre',
        'ruc',
        'tipo',
        'telefono',
        'email',
        'password',
        'ciudad',
        'activo',
        'tarifa_dp',
        'tarifa_rc',
    ];

    protected $hidden = [
        'password',
        'remember_token',
    ];

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

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

    public function tarifas(): HasMany
    {
        return $this->hasMany(TarifaAjustador::class);
    }

    public function casos(): HasMany
    {
        return $this->hasMany(Caso::class);
    }

    public function facturas(): HasMany
    {
        return $this->hasMany(Factura::class);
    }
}
