<?php

use Illuminate\Support\Facades\Route;
use Modules\Account\Controllers\Api\BillController;
use Modules\Account\Controllers\Api\FamilyController;
use Modules\Account\Controllers\Api\StatisticsController;

/*
|--------------------------------------------------------------------------
| Account API Routes
|--------------------------------------------------------------------------
|
| 账单、家庭、统计相关API路由
|
*/

Route::middleware(['auth:api'])->group(function () {
    // 账单路由
    Route::prefix('bill')->group(function () {
        Route::get('list', [BillController::class, 'index']);
        Route::post('add', [BillController::class, 'add']);
        Route::post('edit', [BillController::class, 'edit']);
        Route::post('delete', [BillController::class, 'delete']);
        Route::get('detail', [BillController::class, 'detail']);
    });

    // 家庭路由
    Route::prefix('family')->group(function () {
        Route::get('info', [FamilyController::class, 'info']);
        Route::post('create', [FamilyController::class, 'create']);
        Route::post('join', [FamilyController::class, 'join']);
        Route::post('leave', [FamilyController::class, 'leave']);
        Route::get('invite-code', [FamilyController::class, 'inviteCode']);
        Route::post('regenerate-invite-code', [FamilyController::class, 'regenerateInviteCode']);
        Route::post('remove-member', [FamilyController::class, 'removeMember']);
        Route::get('members', [FamilyController::class, 'members']);
        Route::post('transfer-owner', [FamilyController::class, 'transferOwner']);
    });

    // 统计路由
    Route::prefix('statistics')->group(function () {
        Route::get('overview', [StatisticsController::class, 'overview']);
        Route::get('trend', [StatisticsController::class, 'trend']);
        Route::get('category', [StatisticsController::class, 'category']);
        Route::get('monthly', [StatisticsController::class, 'monthly']);
        Route::get('yearly', [StatisticsController::class, 'yearly']);
        Route::get('dashboard', [StatisticsController::class, 'dashboard']);
    });
});
