id

abstract val id: String

Represents a unique identifier for the implementing entity.

This identifier serves as the primary key for distinguishing between different instances of the same type. It is used extensively in:

  • Database operations for record identification

  • State management and event sourcing

  • Caching mechanisms

  • Equality and hashing operations

  • API endpoints and resource references

The identifier must be:

  • Unique across all instances of the implementing type

  • Immutable once assigned

  • Non-null and non-empty

  • Suitable for use as a string key in maps and databases

Return

A string representation of the unique identifier. The format and generation strategy depend on the implementing class.