# `MedicationId` — `src/domain/value_objects/medication_id.rs`
Unique identity for a [`Medication`](../entities/medication.md) aggregate root.
Wraps a UUID v7 — each call to `create()` produces a globally unique, time-sortable value.
---
## Constructors
```rust
pub fn create() -> MedicationId // generates UUID v7 (time-sortable)
pub fn from_uuid(uuid: Uuid) -> MedicationId // wraps an existing UUID
impl Default for MedicationId { ... } // delegates to create()
```
---
## Methods
| `value()` | `Uuid` | Returns the underlying UUID |
| `to_string()` | `String` | Formats as a UUID string, e.g. `"550e8400-e29b-..."` |
---
## Usage
```rust
use bitpill::domain::value_objects::medication_id::MedicationId;
let id = MedicationId::create();
println!("{id}"); // "0195f2a3-..."
assert_ne!(MedicationId::create(), MedicationId::create()); // always unique
```
`MedicationId` is generated by [`CreateMedicationService`](../../application/services/create_medication_service.md)
and passed into `Medication::new()` as the first argument.
It is used as a foreign key in [`DoseRecord`](../entities/dose_record.md) and as the
lookup key in [`MedicationRepository`](../../application/ports/medication_repository.md).