package incheon.com.cmm.exception;

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

/**
 * @Class Name : ExceptionSampleController.java
 * @Description : 예외 처리 예시를 테스트하는 컨트롤러
 * @Modification Information
 *
 *    수정일       수정자         수정내용
 *    -------     -------     -------------------
 *
 */
@RestController
@RequestMapping("/api/exception-test")
public class ExceptionSampleController {
    
    @Autowired
    private ExceptionSampleService exceptionSampleService;
    
    /**
     * 비즈니스 예외 테스트
     */
    @GetMapping("/business")
    public String testBusinessException() {
        exceptionSampleService.throwBusinessException();
        return "이 텍스트는 출력되지 않을 것입니다.";
    }
    
    /**
     * 엔티티 찾기 실패 예외 테스트
     */
    @GetMapping("/entity-not-found")
    public String testEntityNotFoundException() {
        exceptionSampleService.throwEntityNotFoundException();
        return "이 텍스트는 출력되지 않을 것입니다.";
    }
    
    /**
     * 잘못된 인자 예외 테스트
     */
    @GetMapping("/illegal-argument")
    public String testIllegalArgumentException() {
        exceptionSampleService.throwIllegalArgumentException();
        return "이 텍스트는 출력되지 않을 것입니다.";
    }
    
    /**
     * 일반 예외 테스트
     */
    @GetMapping("/general")
    public String testGeneralException() {
        exceptionSampleService.throwGeneralException();
        return "이 텍스트는 출력되지 않을 것입니다.";
    }
} 