kreta/Kreta.WebApi/Naplo/Kreta.Naplo.Dto/V3/Exception/NaploExceptionResponseDto.cs
2024-03-13 00:33:46 +01:00

43 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Kreta.Core.Domain;
using Kreta.Core.Enum;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Kreta.Naplo.Dto.V3.Exception
{
public class NaploExceptionResponseDto
{
public NaploExceptionResponseDto(BlExceptionType exceptionType, string message)
{
ExceptionType = exceptionType;
Message = message;
}
public NaploExceptionResponseDto(BlExceptionType exceptionType, string message, List<DetailedErrorItem> errorList)
{
ExceptionType = exceptionType;
Message = message;
if (errorList != null && errorList.Count > 0)
{
ErrorList = errorList;
}
}
[Required, Description("Hiba egyedi azonosítója")]
public Guid ExceptionId => Guid.NewGuid();
[Required, Description("Az exception típusa; röviden az ok, ami kiváltotta"), JsonConverter(typeof(StringEnumConverter))]
public BlExceptionType ExceptionType { get; set; }
[Required, Description("Ember által olvasható hibaüzenet<br>kliens dönti el, hogy megjeleníti-e a felhasználó számára")]
public string Message { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] ////DevKornel: Swagger miatt
[Description("Ember által olvasható hibalista, null ha nincs plusz információ<br>kliens dönti el, hogy megjeleníti-e a felhasználó számára")]
public List<DetailedErrorItem> ErrorList { get; set; }
}
}