<?php

use App\Models\AgentProfile;
use App\Support\AgentDefaultRolePermissions;

test('base owner slugs include dashboard and settlement view but not wallet reconcile or platform reports', function (): void {
    $slugs = AgentDefaultRolePermissions::baseSlugs();

    expect($slugs)
        ->toContain('prd.dashboard.view')
        ->toContain('prd.settlement.agent.view')
        ->not->toContain('prd.report.view')
        ->not->toContain('prd.wallet_reconcile.view')
        ->not->toContain('prd.wallet_reconcile.view_cs');
});

test('line root owner slugs include agent management packages', function (): void {
    $slugs = AgentDefaultRolePermissions::lineRootOwnerSlugs();

    expect($slugs)
        ->toContain('prd.agent.manage')
        ->toContain('prd.settlement.agent.manage')
        ->toContain('prd.agent.role.manage');
});

test('owner slugs from profile add manage slugs when capabilities enabled', function (): void {
    $profile = new AgentProfile([
        'can_create_child_agent' => true,
        'can_create_player' => false,
    ]);

    $slugs = AgentDefaultRolePermissions::ownerSlugsFromProfile($profile);

    expect($slugs)
        ->toContain('prd.agent.manage')
        ->toContain('prd.agent.profile.manage')
        ->not->toContain('prd.users.manage');
});
