<?php

namespace App\Repositories;

use App\Models\AgencyModel;

/**
 * The agencies table IS the tenant table — it has no agency_id column to
 * scope by. Access control here is role-based (Super Admin sees all,
 * Agency Owner sees only their own row via owner_user_id), not tenant-scoped
 * in the BaseRepository sense.
 */
class AgencyRepository extends BaseRepository
{
    protected ?string $tenantColumn = null;

    public function __construct(AgencyModel $model)
    {
        parent::__construct($model);
    }

    public function findBySlug(string $slug): ?object
    {
        return $this->model->findBySlug($slug);
    }

    public function findOwnedBy(int $userId): ?object
    {
        return $this->model->where('owner_user_id', $userId)->first();
    }
}
