| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | |
| | | 3 | | namespace FAU.Logica.DTOs; |
| | | 4 | | |
| | | 5 | | public static class TiposFicto |
| | | 6 | | { |
| | | 7 | | public const string Comedor = "comedor"; |
| | | 8 | | public const string Guarderia = "guarderia"; |
| | | 9 | | public const string Ticket = "ticket"; |
| | | 10 | | |
| | | 11 | | public static readonly IReadOnlySet<string> Todos = |
| | | 12 | | new HashSet<string>(StringComparer.OrdinalIgnoreCase) |
| | | 13 | | { |
| | | 14 | | Comedor, |
| | | 15 | | Guarderia, |
| | | 16 | | Ticket |
| | | 17 | | }; |
| | | 18 | | |
| | | 19 | | public static readonly IReadOnlySet<string> Importables = |
| | | 20 | | new HashSet<string>(StringComparer.OrdinalIgnoreCase) |
| | | 21 | | { |
| | | 22 | | Comedor, |
| | | 23 | | Guarderia |
| | | 24 | | }; |
| | | 25 | | } |
| | | 26 | | |
| | | 27 | | public class FictoPersonaDto |
| | | 28 | | { |
| | | 29 | | public long Id { get; set; } |
| | | 30 | | public long PersonaId { get; set; } |
| | | 31 | | public string Cedula { get; set; } = string.Empty; |
| | | 32 | | public string NombreCompleto { get; set; } = string.Empty; |
| | | 33 | | public string Tipo { get; set; } = string.Empty; |
| | | 34 | | public decimal Importe { get; set; } |
| | | 35 | | public bool Activo { get; set; } |
| | | 36 | | public string AcreedorCodigo { get; set; } = string.Empty; |
| | | 37 | | public string AcreedorNombre { get; set; } = string.Empty; |
| | | 38 | | public string? Observaciones { get; set; } |
| | | 39 | | public DateTime FechaCreacion { get; set; } |
| | | 40 | | public DateTime? FechaModificacion { get; set; } |
| | | 41 | | public DateTime? FechaBaja { get; set; } |
| | | 42 | | } |
| | | 43 | | |
| | | 44 | | public class CrearFictoPersonaRequest |
| | | 45 | | { |
| | | 46 | | [Required] |
| | | 47 | | [MaxLength(12)] |
| | | 48 | | public string CedulaTitular { get; set; } = string.Empty; |
| | | 49 | | |
| | | 50 | | [Required] |
| | | 51 | | [MaxLength(20)] |
| | | 52 | | public string Tipo { get; set; } = string.Empty; |
| | | 53 | | |
| | | 54 | | [Range(0.01, 999999999999.99)] |
| | | 55 | | public decimal Importe { get; set; } |
| | | 56 | | |
| | | 57 | | [MaxLength(500)] |
| | | 58 | | public string? Observaciones { get; set; } |
| | | 59 | | } |
| | | 60 | | |
| | | 61 | | public class ActualizarFictoPersonaRequest |
| | | 62 | | { |
| | | 63 | | [Range(0.01, 999999999999.99)] |
| | 5 | 64 | | public decimal Importe { get; set; } |
| | | 65 | | |
| | | 66 | | [MaxLength(500)] |
| | 2 | 67 | | public string? Observaciones { get; set; } |
| | | 68 | | } |
| | | 69 | | |
| | | 70 | | public class FilaImportacionFictoRequest |
| | | 71 | | { |
| | | 72 | | [Required] |
| | | 73 | | [MaxLength(20)] |
| | | 74 | | public string Tipo { get; set; } = string.Empty; |
| | | 75 | | |
| | | 76 | | [Range(2, 10000)] |
| | | 77 | | public int NumeroFila { get; set; } |
| | | 78 | | |
| | | 79 | | [Required] |
| | | 80 | | [MaxLength(12)] |
| | | 81 | | public string Cedula { get; set; } = string.Empty; |
| | | 82 | | |
| | | 83 | | [Range(0.01, 999999999999.99)] |
| | | 84 | | public decimal Importe { get; set; } |
| | | 85 | | } |
| | | 86 | | |
| | | 87 | | public class ImportarFictosRequest |
| | | 88 | | { |
| | | 89 | | [Required] |
| | | 90 | | [MaxLength(255)] |
| | | 91 | | public string NombreArchivo { get; set; } = string.Empty; |
| | | 92 | | |
| | | 93 | | [MaxLength(64)] |
| | | 94 | | public string? HashArchivo { get; set; } |
| | | 95 | | |
| | | 96 | | [Required] |
| | | 97 | | [MinLength(1)] |
| | | 98 | | [MaxLength(20000)] |
| | | 99 | | public List<FilaImportacionFictoRequest> Filas { get; set; } = []; |
| | | 100 | | } |
| | | 101 | | |
| | | 102 | | public class ErrorImportacionFictoDto |
| | | 103 | | { |
| | | 104 | | public string Tipo { get; set; } = string.Empty; |
| | | 105 | | public int NumeroFila { get; set; } |
| | | 106 | | public string Cedula { get; set; } = string.Empty; |
| | | 107 | | public string Mensaje { get; set; } = string.Empty; |
| | | 108 | | } |
| | | 109 | | |
| | | 110 | | public class ResultadoValidacionImportacionFictosDto |
| | | 111 | | { |
| | | 112 | | public bool EsValido => Errores.Count == 0; |
| | | 113 | | public int TotalFilas { get; set; } |
| | | 114 | | public int Nuevos { get; set; } |
| | | 115 | | public int Actualizados { get; set; } |
| | | 116 | | public int Reactivados { get; set; } |
| | | 117 | | public int SinCambios { get; set; } |
| | | 118 | | public List<ErrorImportacionFictoDto> Errores { get; set; } = []; |
| | | 119 | | } |
| | | 120 | | |
| | | 121 | | public class ResultadoImportacionFictosDto : ResultadoValidacionImportacionFictosDto |
| | | 122 | | { |
| | | 123 | | public bool Aplicado { get; set; } |
| | | 124 | | } |