dotnet-geo-management/Svrnty.GeoManagement.Abstractions/Models/Address.cs
Mathias Beaulieu-Duncan c6e6b29905
All checks were successful
Publish NuGet Packages / build-and-publish (push) Successful in 29s
refactor Country to CountryCode to better reflect the value it contain
2025-10-08 11:35:23 -04:00

33 lines
1.0 KiB
C#

using Svrnty.GeoManagement.Abstractions.Abstractions;
namespace Svrnty.GeoManagement.Abstractions.Models;
public record GeoPoint(decimal Latitude, decimal Longitude);
public record Address(bool Normalized = false) : IAddress
{
public required string Line1 { get; set; }
public string? Line2 { get; set; }
public required string City { get; set; }
public required string Subdivision { get; set; }
public required string PostalCode { get; set; }
public required string CountryCode { get; set; }
public GeoPoint? Location { get; set; }
public string? Note { get; set; }
public bool IsNormalized() => Normalized;
public static Address CreateFrom(IAddress address, GeoPoint? location = null, string? note = null, bool normalized = false)
{
return new Address(normalized)
{
Line1 = address.Line1,
Line2 = address.Line2,
City = address.City,
Subdivision = address.Subdivision,
PostalCode = address.PostalCode,
CountryCode = address.CountryCode,
Location = location,
Note = note,
};
}
}