package com.ikon.projectmanagement.controller;

import com.ikon.projectmanagement.api.ScheduleApi;
import com.ikon.projectmanagement.dto.request.ScheduleRequestDto;
import com.ikon.projectmanagement.dto.response.ScheduleResponseDto;
import com.ikon.projectmanagement.service.ScheduleService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

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

@RestController
@RequiredArgsConstructor
public class ScheduleController implements ScheduleApi {

    private final ScheduleService scheduleService;

    @Override
    public ResponseEntity<ScheduleResponseDto> saveSchedule(
            String accessToken,
            UUID projectIdentifier,
            ScheduleRequestDto scheduleRequestDto) {
        return ResponseEntity.ok(scheduleService.saveSchedule(projectIdentifier, scheduleRequestDto, accessToken));
    }

    @Override
    public ResponseEntity<ScheduleResponseDto> getSchedule(
            String accessToken,
            UUID projectIdentifier) {
        return ResponseEntity.ok(scheduleService.getSchedule(projectIdentifier, accessToken));
    }

    @Override
    public ResponseEntity<List<ScheduleResponseDto>> getAllSchedules(String accessToken) {
        return ResponseEntity.ok(scheduleService.getAllSchedules());
    }
}
