<?php

namespace Modules\Mobile;

use Gestoreasy\Core\Module\ModuleInterface;
use Gestoreasy\Core\Routing\Router;
use Gestoreasy\Core\Http\AuthMiddleware;
use Modules\Mobile\Controllers\MobileController;

class Module implements ModuleInterface {
    public function register(Router $router): void {
        $ctrl = new MobileController();

        // API Mobile - Produtos
        $router->get('/api/mobile/products', [$ctrl, 'getProducts'], [AuthMiddleware::requireAuth()]);
        
        // API Mobile - Clientes
        $router->get('/api/mobile/clients', [$ctrl, 'getClients'], [AuthMiddleware::requireAuth()]);
        
        // API Mobile - Pedidos
        $router->get('/api/mobile/orders', [$ctrl, 'getOrders'], [AuthMiddleware::requireAuth()]);
        $router->get('/api/mobile/orders/{id}/items', [$ctrl, 'getOrderItems'], [AuthMiddleware::requireAuth()]);
        $router->post('/api/mobile/orders', [$ctrl, 'createOrder'], [AuthMiddleware::requireAuth()]);
        $router->put('/api/mobile/orders/{id}', [$ctrl, 'updateOrder'], [AuthMiddleware::requireAuth()]);
        
        // API Mobile - Sincronização
        $router->post('/api/mobile/sync', [$ctrl, 'syncAll'], [AuthMiddleware::requireAuth()]);
        
        // API Mobile - Metas
        $router->get('/api/mobile/goals', [$ctrl, 'getGoals'], [AuthMiddleware::requireAuth()]);
        
        // API Mobile - Comissões
        $router->get('/api/mobile/commissions', [$ctrl, 'getCommissions'], [AuthMiddleware::requireAuth()]);
        $router->get('/api/mobile/commissions/summary', [$ctrl, 'getCommissionsSummary'], [AuthMiddleware::requireAuth()]);
        
        // API Mobile - Check-ins
        $router->post('/api/mobile/checkins', [$ctrl, 'createCheckIn'], [AuthMiddleware::requireAuth()]);
        $router->get('/api/mobile/checkins', [$ctrl, 'getCheckIns'], [AuthMiddleware::requireAuth()]);
    }

    public function name(): string { return 'Mobile API'; }
    public function version(): string { return '1.0.0'; }
    public function dependencies(): array { return []; }
}

