<?php

namespace App\Domains\Admin\Repositories;

use App\Models\Tenant;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Collection as SupportCollection;

class AdminTenantRepository
{
    public function findBySlug(string $slug): Tenant
    {
        return Tenant::where('slug', $slug)->firstOrFail();
    }

    public function getActiveTenants(): Collection
    {
        return Tenant::where('has_active_instance', true)->get();
    }

    public function getTenantNames(): SupportCollection
    {
        return Tenant::pluck('name', 'slug');
    }

    public function getActiveLocalGroups(): Collection
    {
        return Tenant::where('is_active_local_group', true)->get();
    }
}
