package com.devjob.dto;

/**
 * 모든 API 응답을 감싸는 공통 응답 래퍼.
 *
 * <pre>
 * {
 *   "success": true,
 *   "message": "success",
 *   "data": { ... }
 * }
 * </pre>
 */
public record ApiResponse<T>(
        boolean success,
        String message,
        T data
) {

    public static <T> ApiResponse<T> ok(T data) {
        return new ApiResponse<>(true, "success", data);
    }

    public static <T> ApiResponse<T> ok(String message, T data) {
        return new ApiResponse<>(true, message, data);
    }

    public static ApiResponse<Void> fail(String message) {
        return new ApiResponse<>(false, message, null);
    }
}
