|
| 1 | +package com.semosan.api.domain.tracking.controller.docs; |
| 2 | + |
| 3 | +import com.semosan.api.common.response.ApiResponse; |
| 4 | +import com.semosan.api.domain.tracking.dto.request.CreateTrackingSessionRequest; |
| 5 | +import com.semosan.api.domain.tracking.dto.response.TrackingSessionResponse; |
| 6 | +import io.swagger.v3.oas.annotations.Operation; |
| 7 | +import io.swagger.v3.oas.annotations.Parameter; |
| 8 | +import io.swagger.v3.oas.annotations.media.Content; |
| 9 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 10 | +import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| 11 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 12 | +import jakarta.validation.Valid; |
| 13 | +import org.springframework.http.ResponseEntity; |
| 14 | +import org.springframework.security.core.annotation.AuthenticationPrincipal; |
| 15 | +import org.springframework.web.bind.annotation.PathVariable; |
| 16 | +import org.springframework.web.bind.annotation.RequestBody; |
| 17 | + |
| 18 | +@Tag(name = "Tracking Session", description = "트래킹 세션 관리 API") |
| 19 | +public interface TrackingSessionControllerDocs { |
| 20 | + |
| 21 | + @Operation( |
| 22 | + summary = "트래킹 세션 시작", |
| 23 | + description = "산/코스 정보로 새 트래킹 세션을 생성합니다. 자유 기록(isFreeRecording=true)이면 courseId 는 무시됩니다. " |
| 24 | + + "유저당 진행 중 세션이 이미 있으면 409 응답." |
| 25 | + ) |
| 26 | + @ApiResponses({ |
| 27 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "201", description = "세션 생성 성공"), |
| 28 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", description = "산 또는 코스 없음", |
| 29 | + content = @Content(schema = @Schema(implementation = ApiResponse.class))), |
| 30 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "409", description = "이미 진행 중인 세션 존재", |
| 31 | + content = @Content(schema = @Schema(implementation = ApiResponse.class))) |
| 32 | + }) |
| 33 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> createSession( |
| 34 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId, |
| 35 | + @Valid @RequestBody CreateTrackingSessionRequest request |
| 36 | + ); |
| 37 | + |
| 38 | + @Operation(summary = "현재 진행 중 트래킹 세션 조회", |
| 39 | + description = "앱 재진입 시 호출. 진행 중(IN_PROGRESS/PAUSED) 세션이 없으면 data 가 비어 응답됩니다.") |
| 40 | + @ApiResponses({@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "조회 성공")}) |
| 41 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> getActiveSession( |
| 42 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId |
| 43 | + ); |
| 44 | + |
| 45 | + @Operation(summary = "트래킹 세션 상세 조회", description = "본인 소유 세션만 조회 가능합니다.") |
| 46 | + @ApiResponses({ |
| 47 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "조회 성공"), |
| 48 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "403", description = "본인 세션 아님", |
| 49 | + content = @Content(schema = @Schema(implementation = ApiResponse.class))), |
| 50 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", description = "세션 없음", |
| 51 | + content = @Content(schema = @Schema(implementation = ApiResponse.class))) |
| 52 | + }) |
| 53 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> getSession( |
| 54 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId, |
| 55 | + @Parameter(description = "세션 ID", required = true) @PathVariable Long sessionId |
| 56 | + ); |
| 57 | + |
| 58 | + @Operation(summary = "트래킹 세션 일시정지", description = "IN_PROGRESS 상태에서만 가능. 점 수집은 멈추고 duration 에서 제외됩니다.") |
| 59 | + @ApiResponses({ |
| 60 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "일시정지 성공"), |
| 61 | + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "409", description = "현재 상태에서 일시정지 불가", |
| 62 | + content = @Content(schema = @Schema(implementation = ApiResponse.class))) |
| 63 | + }) |
| 64 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> pauseSession( |
| 65 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId, |
| 66 | + @PathVariable Long sessionId |
| 67 | + ); |
| 68 | + |
| 69 | + @Operation(summary = "트래킹 세션 재개", description = "PAUSED 상태에서만 가능. 일시정지 누적 시간이 합산됩니다.") |
| 70 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> resumeSession( |
| 71 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId, |
| 72 | + @PathVariable Long sessionId |
| 73 | + ); |
| 74 | + |
| 75 | + @Operation(summary = "트래킹 세션 정상 종료", |
| 76 | + description = "세션 상태/시각만 마감합니다. 실제 HikingRecord 변환은 #20 에서 구현됩니다.") |
| 77 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> completeSession( |
| 78 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId, |
| 79 | + @PathVariable Long sessionId |
| 80 | + ); |
| 81 | + |
| 82 | + @Operation(summary = "트래킹 세션 포기", description = "기록 없이 세션을 ABANDONED 처리합니다.") |
| 83 | + ResponseEntity<ApiResponse<TrackingSessionResponse>> abandonSession( |
| 84 | + @Parameter(hidden = true) @AuthenticationPrincipal Long userId, |
| 85 | + @PathVariable Long sessionId |
| 86 | + ); |
| 87 | +} |
0 commit comments