# [Digital](../domain.md) ## Entities ### Contact Address A Contact Address is the link between a Party and an Address: what the address is used for, whether it has been confirmed, and the period it was in use. It is not the address itself — the location lives in the Address entity and is shared. That separation buys two things. Deduplication: when two parties share a location, one Address record exists and both point at it, so "who else is at this address" is a join rather than a fuzzy string match. And time: because the association carries valid from and to dates, you can answer "where were we sending this customer's mail last March", which is exactly what you need when a delivery goes missing or a dispute is raised. A Party *has* Contact Addresses — it owns them. A Party Role *uses* them: a role points at whichever of the party's addresses applies in its context. The same person might have a home address for identity and a separate billing address used by their Customer role. ```mermaid --- config: layout: elk --- classDiagram class ContactAddress{ * Contact Address Identifier : string Address Purpose : enum~AddressPurpose~ Is Primary : boolean Verification Status : enum~AddressVerificationStatus~ Verification Date : date Verification Method : enum~VerificationMethod~ Valid From : date Valid To : date } Party "1" --> "0..*" ContactAddress : has PartyRole "0..*" --> "0..*" ContactAddress : uses ContactAddress "0..*" --> "1" Address : references class AddressPurpose["Address Purpose"]{<>} class AddressVerificationStatus["Address Verification Status"]{<>} class VerificationMethod["Verification Method"]{<>} class Party["Party"] class PartyRole["Party Role"] class Address["Address"] ``` ```yaml existence: associative mutability: slowly_changing temporal: tracking: valid_time description: > Valid time is carried explicitly as Valid From and Valid To rather than left to generated columns. This allows a move to be recorded before it happens — a customer tells you in June that they move in July — and keeps point-in-time lookups honest. attributes: Contact Address Identifier: type: string identifier: primary description: > Globally unique identifier for this party-to-address association. Address Purpose: type: enum:Address Purpose description: > What the party uses this address for. A party can hold several addresses at once for different purposes — home, billing and delivery are frequently different places. Is Primary: type: boolean default: false description: > Whether this is the party's main address for the given purpose. At most one address may be primary per purpose at any point in time. Verification Status: type: enum:Address Verification Status description: > Whether this address has been confirmed as real and current. Unverified addresses are usable but should not be relied on for anything expensive, such as a physical delivery. Verification Date: type: date description: > When the address was last confirmed. Verification ages: an address confirmed five years ago is weaker evidence than one confirmed last month. Verification Method: type: enum:Verification Method description: > How the address was confirmed. Recorded because the methods are not equally strong, and knowing which was used determines how much weight to put on the result. Valid From: type: date description: > The date the party started using this address for the stated purpose. Valid To: type: date description: > The date the party stopped using it. Null means still in use. Closed associations are kept rather than deleted, so historical lookups stay accurate. ``` ```yaml constraints: One Primary Per Purpose: check: > COUNT(Contact Address WHERE Party == this.Party AND Address Purpose == this.Address Purpose AND Is Primary == true AND (Valid To IS NULL OR Valid To >= Today)) <= 1 description: > A party may have at most one primary Contact Address per purpose at any point in time. Two primary billing addresses is not a preference, it is a bug. Valid To After Valid From: check: "Valid To IS NULL OR Valid To > Valid From" description: > The end of the validity period must be later than the start. Verification Date Required When Verified: check: > Verification Status != 'Verified' OR Verification Date IS NOT NULL description: > An address marked Verified must record when it was verified, otherwise the status cannot be aged or trusted. ``` ```yaml governance: pii: true classification: Confidential retention: 7 years retention_basis: Domain default description: > A contact address ties a person to a location, which makes this association personal data even though the Address it points at is not. Records are closed via Valid To rather than deleted. access_role: - CUSTOMER_SERVICE - PRIVACY_OFFICER ``` ## Relationships ### Contact Address References Address Each Contact Address references exactly one canonical Address record. ```yaml source: Contact Address type: references target: Address cardinality: many-to-one granularity: atomic ownership: Contact Address ```