<?php
use Incoviba\Controller\API\Proyectos\Brokers;
use Incoviba\Controller\API\Proyectos\Brokers\Contracts;

$app->group('/brokers', function($app) {
    $app->group('/contracts', function($app) {
        $app->post('/add[/]', [Contracts::class, 'add']);
        $app->get('[/]', Contracts::class);
    });
    $app->group('/contract/{contract_id}', function($app) {
        $app->post('/edit[/]', [Contracts::class, 'edit']);
        $app->post('/inactive[/]', [Contracts::class, 'inactive']);
        $app->delete('[/]', [Contracts::class, 'delete']);
        $app->get('[/]', [Contracts::class, 'get']);
    });
    $app->post('/add[/]', [Brokers::class, 'add']);
    $app->post('/edit[/]', [Brokers::class, 'edit']);
    $app->get('[/]', Brokers::class);
});
$app->group('/broker/{broker_rut}', function($app) {
    $app->group('/contracts', function($app) {
        $app->post('/add[/]', [Contracts::class, 'add']);
        $app->get('[/]', [Contracts::class, 'getByBroker']);
    });
    $app->group('/contract/{contract_id}', function($app) {
        $app->post('/promotions[/]', [Contracts::class, 'promotions']);
    });
    $app->delete('[/]', [Brokers::class, 'delete']);
    $app->get('[/]', [Brokers::class, 'get']);
});
