package incheon.uis.uld.service;

import lombok.Getter;
import org.springframework.http.HttpStatus;

import java.util.List;

/**
 * 레이어 동기화 유효성 검사 실패 예외
 * 에러 메시지를 배열 형태로 반환
 *
 * @author 호지원
 * @since 2025.01.30
 */
@Getter
public class LayerSyncException extends RuntimeException {

    private final List<String> errors;
    private final HttpStatus status;

    public LayerSyncException(List<String> errors) {
        super(String.join(", ", errors));
        this.errors = errors;
        this.status = HttpStatus.BAD_REQUEST;
    }

    public LayerSyncException(List<String> errors, HttpStatus status) {
        super(String.join(", ", errors));
        this.errors = errors;
        this.status = status;
    }

    public LayerSyncException(String error) {
        super(error);
        this.errors = List.of(error);
        this.status = HttpStatus.BAD_REQUEST;
    }

    public LayerSyncException(String error, HttpStatus status) {
        super(error);
        this.errors = List.of(error);
        this.status = status;
    }
}
