package com.sonymusic.dx.dxuiservice.controllers;

import java.text.ParseException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sonymusic.dx.dxuiservice.model.RecordingProjectModel;
import com.sonymusic.dx.dxuiservice.service.RecordingProjectService;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "RecordingProject", description = "RecordingProject UI Service")
@RestController
@RequestMapping("project")
public class RecordingProjectController {

    @Autowired
    RecordingProjectService recordingProjectService;

    @Operation(summary = "Get RecordingProject details by RecordingProject Number", responses = {
			@ApiResponse(responseCode = "200", description = "OK"),
			@ApiResponse(responseCode = "400", description = "Bad request") })
    @GetMapping("/by-projectNo/{projectNo}")
    public RecordingProjectModel getRecordingProjectByProjectNo(@PathVariable("projectNo") String projectNo) throws ParseException {
        return recordingProjectService.getRecordingProjectByProjectNo(projectNo);
    }

    @Operation(summary = "Get RecordingProject details by RecordingProject Id", responses = {
			@ApiResponse(responseCode = "200", description = "OK"),
			@ApiResponse(responseCode = "400", description = "Bad request") })
    @GetMapping("/by-projectId/{projectId}")
    public RecordingProjectModel getRecordingProjectByProjectId(@PathVariable("projectId") String projectId) throws ParseException {
        return recordingProjectService.getRecordingProjectByProjectId(projectId);
    }
}
