<?php

namespace App\Http\Controllers\Api\V1;

use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\DashboardCeoService;
use Illuminate\Http\JsonResponse;

/**
 * CEO 대시보드 섹션별 API 컨트롤러
 *
 * 6개 섹션: 매출, 매입, 생산, 미출고, 시공, 근태
 */
class DashboardCeoController extends Controller
{
    public function __construct(
        private readonly DashboardCeoService $service
    ) {}

    /**
     * 매출 현황 요약
     * GET /api/v1/dashboard/sales/summary
     */
    public function salesSummary(): JsonResponse
    {
        return ApiResponse::handle(
            fn () => $this->service->salesSummary(),
            __('message.fetched')
        );
    }

    /**
     * 매입 현황 요약
     * GET /api/v1/dashboard/purchases/summary
     */
    public function purchasesSummary(): JsonResponse
    {
        return ApiResponse::handle(
            fn () => $this->service->purchasesSummary(),
            __('message.fetched')
        );
    }

    /**
     * 생산 현황 요약
     * GET /api/v1/dashboard/production/summary
     */
    public function productionSummary(): JsonResponse
    {
        return ApiResponse::handle(
            fn () => $this->service->productionSummary(),
            __('message.fetched')
        );
    }

    /**
     * 미출고 내역 요약
     * GET /api/v1/dashboard/unshipped/summary
     */
    public function unshippedSummary(): JsonResponse
    {
        return ApiResponse::handle(
            fn () => $this->service->unshippedSummary(),
            __('message.fetched')
        );
    }

    /**
     * 시공 현황 요약
     * GET /api/v1/dashboard/construction/summary
     */
    public function constructionSummary(): JsonResponse
    {
        return ApiResponse::handle(
            fn () => $this->service->constructionSummary(),
            __('message.fetched')
        );
    }

    /**
     * 근태 현황 요약
     * GET /api/v1/dashboard/attendance/summary
     */
    public function attendanceSummary(): JsonResponse
    {
        return ApiResponse::handle(
            fn () => $this->service->attendanceSummary(),
            __('message.fetched')
        );
    }
}
