44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
namespace GestionaDenuncias.Shared.Models;
|
|
|
|
public sealed class ThirdPartyAddressData
|
|
{
|
|
public string? Street { get; set; }
|
|
public string? Number { get; set; }
|
|
public string? Floor { get; set; }
|
|
public string? Door { get; set; }
|
|
public string? Block { get; set; }
|
|
public string? Stair { get; set; }
|
|
public string? Municipality { get; set; }
|
|
public string? Province { get; set; }
|
|
public string? ZipCode { get; set; }
|
|
public string? CountryCode { get; set; }
|
|
public string? RoadTypeCode { get; set; } = "CL";
|
|
|
|
public bool HasAnyValue =>
|
|
!string.IsNullOrWhiteSpace(Street) ||
|
|
!string.IsNullOrWhiteSpace(Number) ||
|
|
!string.IsNullOrWhiteSpace(Municipality) ||
|
|
!string.IsNullOrWhiteSpace(Province) ||
|
|
!string.IsNullOrWhiteSpace(ZipCode);
|
|
|
|
public static ThirdPartyAddressData? FromComplaint(DenunciasGestiona denuncia)
|
|
{
|
|
var data = new ThirdPartyAddressData
|
|
{
|
|
Street = denuncia.Direccion,
|
|
RoadTypeCode = denuncia.DireccionTipoVia,
|
|
Number = denuncia.DireccionNumero,
|
|
Floor = denuncia.DireccionPiso,
|
|
Door = denuncia.DireccionPuerta,
|
|
Block = denuncia.DireccionBloque,
|
|
Stair = denuncia.DireccionEscalera,
|
|
Municipality = denuncia.Municipio,
|
|
Province = denuncia.Provincia,
|
|
ZipCode = denuncia.CodigoPostal,
|
|
CountryCode = string.IsNullOrWhiteSpace(denuncia.Pais) ? denuncia.PaisOrigen : denuncia.Pais,
|
|
};
|
|
|
|
return data.HasAnyValue ? data : null;
|
|
}
|
|
}
|