using ColaFlow.Shared.Kernel.Common;

namespace ColaFlow.Modules.Identity.Domain.Aggregates.Invitations;

public sealed class InvitationId : ValueObject
{
    public Guid Value { get; }

    private InvitationId(Guid value)
    {
        Value = value;
    }

    public static InvitationId CreateUnique() => new(Guid.NewGuid());

    public static InvitationId Create(Guid value)
    {
        if (value == Guid.Empty)
            throw new ArgumentException("Invitation ID cannot be empty", nameof(value));

        return new InvitationId(value);
    }

    protected override IEnumerable<object> GetAtomicValues()
    {
        yield return Value;
    }

    public override string ToString() => Value.ToString();

    // Implicit conversion
    public static implicit operator Guid(InvitationId invitationId) => invitationId.Value;
}
