package com.ga.api.controller.external;

import com.ga.api.service.external.ExternalCallLogService;
import com.ga.common.annotation.RequirePermission;
import com.ga.common.model.ApiResponse;
import com.ga.common.model.PageResponse;
import com.ga.core.vo.external.ExternalCallLogResp;
import com.ga.core.vo.external.ExternalCallLogSearchParam;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "외부연동 호출이력")
@RestController
@RequiredArgsConstructor
public class ExternalCallLogController {

    private final ExternalCallLogService service;

    @GetMapping("/api/external-call-logs")
    @RequirePermission(menu = "SYSTEM_EXTERNAL_CALL", perm = "READ")
    public ApiResponse<PageResponse<ExternalCallLogResp>> list(@ModelAttribute ExternalCallLogSearchParam param) {
        return ApiResponse.ok(service.list(param));
    }

    @GetMapping("/api/external-call-logs/{logId}")
    @RequirePermission(menu = "SYSTEM_EXTERNAL_CALL", perm = "READ")
    public ApiResponse<ExternalCallLogResp> detail(@PathVariable Long logId) {
        return ApiResponse.ok(service.detail(logId));
    }
}
