Skip to main content

Blüdhaven Pets domain model

The Blüdhaven Pets platform coordinates companion animal intake, statutory municipal licensing, veterinary health clearances, and retail inventory across three physical branches and an online adoption catalog.

Architecture overview

This document specifies the business logic, state machines, and regulatory invariants behind the Blüdhaven Pets OpenAPI 3.1 contract.

Core entities​

+-------------------+
| Retail Branch |
+-------------------+
|
v
+------------------+ +-------------------+ +--------------------+
| Health Record |<--->| Animal |<--->| Adoption Hold |
+------------------+ +-------------------+ +--------------------+
| |
v v
+-------------------+ +--------------------+
| Inventory | | Applicant |
+-------------------+ +--------------------+

Branch​

Three facilities serve Blüdhaven, and the contract declares their identifiers as the BranchId enum. Every intake record, adoption hold, and supply order names one.

FieldTypeConstraintDescription
idstringBranchId enumloc_harbor_04, loc_downtown_01, or loc_westend_08.
namestring-Trading name of the facility.
kindstringEnumintake, retail, or transitional.
citystring-Municipality the facility serves.
addressstring-Street address for client visits.
phonestring+1 country codeFront desk number.
servicesarray of stringsFree textBookable services, such as spay-neuter.

Animal​

The central entity tracking an individual companion animal across municipal intake, veterinary care, and adoption.

FieldTypeConstraintDescription
idstringPrefix pet_Unique platform identifier.
namestringMax 60 charsAssigned companion name.
speciesstringEnumAllowed values include dog, cat, rabbit, bird, or small_mammal.
breedstringMax 100 charsPrimary recognized breed or mixed lineage.
age_monthsinteger0 or greaterAge in whole months at intake.
sexstringEnummale or female.
weight_kgnumberFloatBody weight in kilograms at the last exam.
microchip_idstringExactly 15 digitsStatutory ISO 11784 and 11785 compliant microchip identifier.
statusstringEnumState machine stage.
intake_branch_idstringBranchId enumOriginating facility from the three in Branch.
intake_datestring (date)ISO 8601Official surrender or rescue intake timestamp.
adoption_fee_centsintegerCentsPlacement fee. The Harbor branch charges 15000 cents ($150) for a dog.
temperament_tagsarray of stringsFree textTraits the adoption floor filters on, such as good-with-cats.
health_recordobjectAnimalHealthRecordNested clinical record for the animal.
photo_urlsarray of URIsAbsolute URLsGallery images served from the media host.

Health record​

Stores clinical evaluations, regulatory immunization logs, and mandatory quarantine milestones.

FieldTypeConstraintDescription
rabies_tag_numberstringFormat RB-YYYY-XXXXMandatory municipal certificate code for rabies vaccinations.
rabies_expiration_datestring (date)ISO 8601, requiredExpiry of the rabies certificate. A lapsed date blocks a hold.
spay_neuter_certifiedbooleanRequiredLegal prerequisite for adoption finalization in municipal code.
quarantine_release_datestring date-timeNullableMandatory 14-day observation release for bite or intake cases.
veterinarian_licensestringFormat DVM-XXXXXState board license number of certifying practitioner.
last_exam_datestring (date)ISO 8601Date of the most recent clinical exam.

Adoption hold​

An exclusive reservation locking an animal during in-person interviews and background verification.

FieldTypeConstraintDescription
idstringPrefix hld_Unique hold record identifier.
animal_idstringForeign keyReferences target animal.
applicant_idstringPrefix usr_References verified adopter profile.
branch_idstringForeign keyBranch where the interview happens.
expires_atstring date-timeISO 8601Enforced 30-minute expiration timestamp from creation.
seconds_remainingintegerComputedCountdown the read route returns, so a client needn't parse timestamps.
statusstringEnumState can be ACTIVE, EXPIRED, RELEASED, or CONVERTED.

Animal state lifecycle​

Every animal advances through a strict state machine. Unregistered or uncertified state jumps return 422 Unprocessable Content.

[INTAKE]
│
▼
[VET_CLEARANCE] ──(Fails quarantine / illness)──► [MEDICAL_QUARANTINE]
│ │
│ (Passes exam & rabies log) │ (Cured & certified)
▼ │
[AVAILABLE] ◄────────────────────────────────────────────┘
│
▼
[RESERVED_HOLD] ──(30-min TTL expires / cancelled)──► [AVAILABLE]
│
│ (Adoption fee paid & license filed)
▼
[ADOPTED]

Lifecycle states​

  • INTAKE: animal admitted through municipal shelter surrender or stray rescue. Catalog visibility stays off.
  • VET_CLEARANCE: animal undergoing clinical intake examination and statutory microchipping.
  • MEDICAL_QUARANTINE: animal isolated due to infectious conditions or bite observation. Clients can't view or hold the record.
  • AVAILABLE: animal cleared by a licensed veterinarian with spay_neuter_certified: true. Listed on web catalog and retail floor.
  • RESERVED_HOLD: exclusive 30-minute reservation lock created by store associate or client app. Prevents double-booking.
  • ADOPTED: adoption completed with municipal pet license fee collected and microchip registry transferred.

Concurrency rules and 30-minute holds​

To prevent race conditions where an in-store customer and an online applicant attempt to reserve the same animal simultaneously:

  1. Atomic hold placement checks that the target animal stores status: "AVAILABLE" before writing the lock record with POST /adoptions/holds.
  2. Conflict response returns an HTTP 409 Conflict using RFC 9457 ProblemDetails whenever an active hold already exists for the animal.
  3. Automated expiration returns the animal to AVAILABLE status whenever the applicant doesn't submit payment within 1,800 seconds. An adoption.hold.expired webhook dispatches to partner feeds.

Regulatory and municipal compliance​

Blüdhaven municipal animal ordinances mandate three immutable constraints:

  1. Intact restrictions prevent animals from entering AVAILABLE or ADOPTED status without verified spay_neuter_certified: true.
  2. Statutory microchip format requires that microchip_id conform to ISO standards with exactly 15 numeric digits.
  3. Rabies tag validation requires dogs and cats older than 12 weeks to record a validated rabies_tag_number before leaving VET_CLEARANCE.