<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use ImovelZapAi\Authentication\Application\Services\RoleProvisioner;
use ImovelZapAi\Tenancy\Infrastructure\Persistence\Eloquent\TenantModel;

class TenantRolesSeeder extends Seeder
{
    public function run(): void
    {
        $provisioner = app(RoleProvisioner::class);

        TenantModel::query()->each(function (TenantModel $tenant) use ($provisioner): void {
            $provisioner->provisionForTenant((string) $tenant->id);
        });
    }
}
