package de.effigenix.domain.usermanagement;

import java.util.UUID;

/**
 * Value Object representing a Role's unique identifier.
 * Immutable and self-validating.
 */
public record RoleId(String value) {

    public RoleId {
        if (value == null || value.isBlank()) {
            throw new IllegalArgumentException("RoleId cannot be null or empty");
        }
    }

    /**
     * Generates a new random RoleId.
     */
    public static RoleId generate() {
        return new RoleId(UUID.randomUUID().toString());
    }

    /**
     * Creates a RoleId from a string value.
     */
    public static RoleId of(String value) {
        return new RoleId(value);
    }
}
