<?php

namespace App\Domains\Client\Models;

use App\Domains\Integration\Models\ClientIntegration;
use App\Domains\Tenant\Models\Tenant;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

#[Fillable(['code', 'name'])]
class Client extends Model
{
    public function getRouteKeyName(): string
    {
        return 'code';
    }

    /** @return HasMany<Tenant, $this> */
    public function tenants(): HasMany
    {
        return $this->hasMany(Tenant::class);
    }

    /** @return HasMany<ClientIntegration, $this> */
    public function integrations(): HasMany
    {
        return $this->hasMany(ClientIntegration::class);
    }
}
