<?php

declare(strict_types=1);

namespace App\Tests\Architecture;

use PHPat\Selector\Selector;
use PHPat\Test\Builder\BuildStep;
use PHPat\Test\PHPat;

/**
 * Tests ensuring Bounded Contexts are properly isolated.
 *
 * Bounded Contexts must communicate through events (via Shared),
 * not through direct dependencies.
 */
final class BoundedContextIsolationTest
{
    public function test_scolarite_should_not_depend_on_vie_scolaire(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Scolarite'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\VieScolaire'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_scolarite_should_not_depend_on_communication(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Scolarite'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Communication'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_scolarite_should_not_depend_on_administration(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Scolarite'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Administration'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_vie_scolaire_should_not_depend_on_scolarite(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\VieScolaire'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Scolarite'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_vie_scolaire_should_not_depend_on_communication(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\VieScolaire'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Communication'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_vie_scolaire_should_not_depend_on_administration(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\VieScolaire'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Administration'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_communication_should_not_depend_on_scolarite(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Communication'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Scolarite'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_communication_should_not_depend_on_vie_scolaire(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Communication'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\VieScolaire'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_communication_should_not_depend_on_administration(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Communication'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Administration'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_administration_should_not_depend_on_scolarite(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Administration'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Scolarite'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_administration_should_not_depend_on_vie_scolaire(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\VieScolaire'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Administration'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }

    public function test_administration_should_not_depend_on_communication(): BuildStep
    {
        return PHPat::rule()
            ->classes(Selector::inNamespace('App\Administration'))
            ->shouldNotDependOn()
            ->classes(Selector::inNamespace('App\Communication'))
            ->because('Bounded Contexts must communicate through events, not direct calls');
    }
}
