<?php

declare(strict_types=1);

arch('it will not use debugging functions')
    ->expect(['dd', 'dump', 'ray'])
    ->each->not->toBeUsed();

arch('all source classes use strict types')
    ->expect('Builder\Core')
    ->toUseStrictTypes();

arch('value objects are final')
    ->expect([
        'Builder\Core\Foundation\Definition\Field',
        'Builder\Core\Foundation\Definition\Section',
        'Builder\Core\Foundation\Definition\Hook',
        'Builder\Core\Foundation\Definition\MenuItem',
        'Builder\Core\Foundation\Resources\ResourceDefinition',
        'Builder\Core\Foundation\Definition\JsModule',
        'Builder\Core\Foundation\Registry',
        'Builder\Core\Foundation\Assets',
        'Builder\Core\BuilderServiceProvider',
    ])
    ->toBeFinal();

arch('resources extend the base Resource class')
    ->expect('Builder\Core\Foundation\Resources\Resource')
    ->toBeAbstract();

arch('extensions extend the base Extension class')
    ->expect('Builder\Core\Foundation\Resources\Extension')
    ->toBeAbstract();

arch('Foundation enums are enums')
    ->expect('Builder\Core\Foundation\Enums')
    ->toBeEnums();

arch('controllers are final and invokable single-action classes')
    ->expect('Builder\Core\Http\Controllers\Resource')
    ->toBeFinal()
    ->toHaveMethod('__invoke');

arch('exceptions extend RuntimeException')
    ->expect('Builder\Core\Exceptions')
    ->toExtend(RuntimeException::class);

arch('schema and resource primitives do not depend on Illuminate\Http')
    ->expect('Builder\Core\Foundation\Definition')
    ->not->toUse('Illuminate\Http\Request')
    ->not->toUse('Illuminate\Http\Response');

arch('concerns only contain protected or private methods')
    ->expect('Builder\Core\Http\Controllers\Concerns')
    ->not->toHavePublicMethods();
