using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; using SPMS.Application.DTOs.Message; using SPMS.Application.Interfaces; using SPMS.Domain.Common; namespace SPMS.API.Controllers; [ApiController] [Route("v1/in/message")] [ApiExplorerSettings(GroupName = "message")] public class MessageController : ControllerBase { private readonly IMessageValidationService _validationService; public MessageController(IMessageValidationService validationService) { _validationService = validationService; } [HttpPost("validate")] [SwaggerOperation(Summary = "메시지 유효성 검사", Description = "메시지 내용의 유효성을 검사합니다.")] public IActionResult ValidateAsync([FromBody] MessageValidateRequestDto request) { var result = _validationService.Validate(request); return Ok(ApiResponse.Success(result)); } private long GetServiceId() { if (HttpContext.Items.TryGetValue("ServiceId", out var serviceIdObj) && serviceIdObj is long serviceId) return serviceId; throw new Domain.Exceptions.SpmsException(ErrorCodes.BadRequest, "서비스 식별 정보가 없습니다.", 400); } }