using RpgRoller.Domain;

namespace RpgRoller.Services;

public static class RollVisibilityParser
{
    public static ServiceResult<RollVisibility> Parse(string visibility)
    {
        if (string.Equals(visibility, "public", StringComparison.OrdinalIgnoreCase))
            return ServiceResult<RollVisibility>.Success(RollVisibility.Public);

        if (string.Equals(visibility, "private", StringComparison.OrdinalIgnoreCase))
            return ServiceResult<RollVisibility>.Success(RollVisibility.Private);

        return ServiceResult<RollVisibility>.Failure("invalid_visibility", "Visibility must be 'public' or 'private'.");
    }
}