package com.social.media.domain.analytics.valueobject;

import java.util.Objects;
import java.util.UUID;

/**
 * Value Object representing a Post Metrics ID
 */
public record PostMetricsId(String value) {
    
    public PostMetricsId {
        Objects.requireNonNull(value, "Post Metrics ID cannot be null");
        if (value.trim().isEmpty()) {
            throw new IllegalArgumentException("Post Metrics ID cannot be empty");
        }
    }
    
    public static PostMetricsId generate() {
        return new PostMetricsId(UUID.randomUUID().toString());
    }
    
    public static PostMetricsId of(String value) {
        return new PostMetricsId(value);
    }
    
    public static PostMetricsId of(Long id) {
        return new PostMetricsId(String.valueOf(id));
    }
    
    @Override
    public String toString() {
        return value;
    }
}
