using StickyBoard.Core.Models; namespace StickyBoard.Core.DTOs.Common; // ========================================================== // 0) API Envelopes // ========================================================== public sealed class ApiResponseDto { public bool Success { get; init; } public string? Message { get; init; } public T? Data { get; init; } public static ApiResponseDto Ok(T data, string? message = null) { return new ApiResponseDto { Success = true, Message = message, Data = data }; } public static ApiResponseDto Ok(string? message = null) { return new ApiResponseDto { Success = true, Message = message }; } // For list types public static ApiResponseDto> OkList(IEnumerable data, string? message = null) { return new ApiResponseDto> { Success = true, Message = message, Data = data }; } public static ApiResponseDto Fail(string message) { return new ApiResponseDto { Success = false, Message = message }; } } public sealed class ErrorDto { public ErrorCode Code { get; init; } = ErrorCode.SERVER_ERROR; // AUTH_INVALID, FORBIDDEN, etc. public string Message { get; init; } = string.Empty; public string? Details { get; init; } }