package com.ikon.projectmanagement.api;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import com.ikon.projectmanagement.dto.response.FxRateResponseDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "FX Rate APIs", description = "FX Rate configuration APIs")
@RequestMapping("/api/v1/fx-rate")
public interface FxRateApi {

    @Operation(summary = "Get all FX rate configurations", description = "Fetches all FX rate configurations.", responses = {
            @ApiResponse(responseCode = "200", description = "FX rate list fetched successfully"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @GetMapping
    ResponseEntity<Page<FxRateResponseDto>> getAllFxRates(
            @RequestHeader("Authorization") String accessToken,
            Pageable pageable);

    @Operation(summary = "Get FX rate by year", description = "Fetches FX rate configuration by year.", parameters = {
            @Parameter(name = "year", description = "Identifier of the year")
    }, responses = {
            @ApiResponse(responseCode = "200", description = "FX rate fetched successfully"),
            @ApiResponse(responseCode = "404", description = "FX rate not found"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @GetMapping("/year={year}")
    ResponseEntity<FxRateResponseDto> getFxRateByYear(
            @RequestHeader("Authorization") String accessToken,
            @PathVariable String year);
}
