package com.caliverse.admin.domain.api;

import com.caliverse.admin.domain.request.AuthenticateRequest;
import com.caliverse.admin.domain.response.AuthenticateResponse;
import com.caliverse.admin.domain.service.AuthenticateService;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@Tag(name = "인증", description = "로그인,로그아웃,회원가입 관련 api 입니다.")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/auth")
public class AuthenticateController {

    private final AuthenticateService authenticateService;

    @PostMapping("/login")
    public ResponseEntity<AuthenticateResponse> login(@RequestBody AuthenticateRequest authenticateRequest){
        return ResponseEntity.ok().body(authenticateService.login(authenticateRequest));
    }

    @PostMapping("/register")
    public ResponseEntity<AuthenticateResponse> register(@RequestBody AuthenticateRequest authenticateRequest){
        return ResponseEntity.ok().body(authenticateService.register(authenticateRequest));
    }

}
