package com.kamco.cd.kamcoback.test;

import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.ErrorResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "test api", description = "test api")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/test")
public class TestApiController {

  @Operation(summary = "admin test", description = "admin test api")
  @ApiResponses({
    @ApiResponse(
        responseCode = "200",
        description = "조회",
        content = @Content(schema = @Schema(implementation = String.class))),
    @ApiResponse(
        responseCode = "403",
        description = "권한 없음",
        content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
  })
  @GetMapping("/admin")
  public ApiResponseDto<String> admin() {
    return ApiResponseDto.ok("I am administrator");
  }

  @Operation(summary = "label test", description = "label test api")
  @ApiResponses({
    @ApiResponse(
        responseCode = "200",
        description = "조회",
        content = @Content(schema = @Schema(implementation = String.class))),
    @ApiResponse(
        responseCode = "403",
        description = "권한 없음",
        content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
  })
  @GetMapping("/label")
  public ApiResponseDto<String> label() {
    return ApiResponseDto.ok("Labeling is available.");
  }

  @Operation(summary = "review test", description = "review test api")
  @ApiResponses({
    @ApiResponse(
        responseCode = "200",
        description = "조회",
        content = @Content(schema = @Schema(implementation = String.class))),
    @ApiResponse(
        responseCode = "403",
        description = "권한 없음",
        content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
  })
  @GetMapping("/review")
  public ApiResponseDto<String> review() {
    return ApiResponseDto.ok("Review is available.");
  }
}
