package com.ikon.projectmanagement.api;

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.tags.Tag;

import java.util.List;
import java.util.UUID;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import com.ikon.projectmanagement.dto.request.MeetingRequestDTO;
import com.ikon.projectmanagement.dto.response.MeetingResponseDTO;

@Tag(name = "Meeting APIs", description = "Meeting Management related APIs")
@RequestMapping("/api/v1/meetings")
public interface MeetingApi {

    // ================= CREATE =================

    @Operation(summary = "Create a new meeting", description = "Creates a new meeting and returns the created meeting details.", requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Meeting details", required = true, content = @Content(schema = @Schema(implementation = MeetingRequestDTO.class))), responses = {
            @ApiResponse(responseCode = "201", description = "Meeting created successfully"),
            @ApiResponse(responseCode = "400", description = "Invalid meeting data"),
            @ApiResponse(responseCode = "401", description = "Unauthorized"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @PostMapping
    ResponseEntity<MeetingResponseDTO> createMeeting(
            @RequestHeader("Authorization") String accessToken,
            @RequestBody MeetingRequestDTO meetingRequestDTO);

    // ================= READ ALL BY PROJECT ID =================

    @Operation(summary = "Get all meetings by project ID", description = "Retrieves a list of all meetings for a given project using project UUID.", responses = {
            @ApiResponse(responseCode = "200", description = "Meetings retrieved successfully"),
            @ApiResponse(responseCode = "401", description = "Unauthorized"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @GetMapping("/project/{projectIdentifier}")
    ResponseEntity<List<MeetingResponseDTO>> getAllMeetings(
            @RequestHeader("Authorization") String accessToken,
            @PathVariable("projectIdentifier") UUID projectIdentifier);

    // ================= READ ALL BY PROJECT IDENTIFIER =================

   

    // ================= READ BY ID =================

    @Operation(summary = "Get meeting by ID", description = "Retrieves a meeting by its unique meeting ID.", responses = {
            @ApiResponse(responseCode = "200", description = "Meeting retrieved successfully"),
            @ApiResponse(responseCode = "401", description = "Unauthorized"),
            @ApiResponse(responseCode = "404", description = "Meeting not found"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @GetMapping("/{meetingId}")
    ResponseEntity<MeetingResponseDTO> getMeetingById(
            @RequestHeader("Authorization") String accessToken,
            @PathVariable("meetingId") UUID meetingId);

    // ================= UPDATE =================

    @Operation(summary = "Update an existing meeting", description = "Updates the details of an existing meeting identified by its ID.", requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Updated meeting details", required = true, content = @Content(schema = @Schema(implementation = MeetingRequestDTO.class))), responses = {
            @ApiResponse(responseCode = "200", description = "Meeting updated successfully"),
            @ApiResponse(responseCode = "400", description = "Invalid meeting data or ID provided"),
            @ApiResponse(responseCode = "401", description = "Unauthorized"),
            @ApiResponse(responseCode = "404", description = "Meeting not found"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @PutMapping("/{meetingId}")
    ResponseEntity<MeetingResponseDTO> updateMeeting(
            @RequestHeader("Authorization") String accessToken,
            @PathVariable("meetingId") UUID meetingId,
            @RequestBody MeetingRequestDTO meetingRequestDTO);

    // ================= DELETE =================

    @Operation(summary = "Delete a meeting", description = "Deletes a meeting identified by its unique meeting ID.", responses = {
            @ApiResponse(responseCode = "204", description = "Meeting deleted successfully"),
            @ApiResponse(responseCode = "401", description = "Unauthorized"),
            @ApiResponse(responseCode = "404", description = "Meeting not found"),
            @ApiResponse(responseCode = "500", description = "Internal server error")
    })
    @DeleteMapping("/{meetingId}")
    ResponseEntity<Void> deleteMeeting(
            @RequestHeader("Authorization") String accessToken,
            @PathVariable("meetingId") UUID meetingId);
}