namespace Appwrite
{
    /// <summary>
    /// Helper class to generate role strings for Permission.
    /// </summary>
    public static class Role
    {
        /// <summary>
        /// Grants access to anyone.
        /// <para>
        /// This includes authenticated and unauthenticated users.
        /// </para>
        /// </summary>
        public static string Any()
        {
            return "any";
        }

        /// <summary>
        /// Grants access to a specific user by user ID.
        /// <para>
        /// You can optionally pass verified or unverified for
        /// <c>status</c> to target specific types of users.
        /// </para>
        /// </summary>
        public static string User(string id, string status = "")
        {
            return status == string.Empty
                ? $"user:{id}"
                : $"user:{id}/{status}";
        }

        /// <summary>
        /// Grants access to any authenticated or anonymous user.
        /// <para>
        /// You can optionally pass verified or unverified for
        /// <c>status</c> to target specific types of users.
        /// </para>
        /// </summary>
        public static string Users(string status = "")
        {
            return status == string.Empty
                ? "users" :
                $"users/{status}";
        }

        /// <summary>
        /// Grants access to any guest user without a session.
        /// <para>
        /// Authenticated users don't have access to this role.
        /// </para>
        /// </summary>
        public static string Guests()
        {
            return "guests";
        }

        /// <summary>
        /// Grants access to a team by team ID.
        /// <para>
        /// You can optionally pass a role for <c>role</c> to target
        /// team members with the specified role.
        /// </para>
        /// </summary>
        public static string Team(string id, string role = "")
        {
            return role == string.Empty
                ? $"team:{id}"
                : $"team:{id}/{role}";
        }

        /// <summary>
        /// Grants access to a specific member of a team.
        /// <para>
        /// When the member is removed from the team, they will
        /// no longer have access.
        /// </para>
        /// </summary>
        public static string Member(string id)
        {
            return $"member:{id}";
        }

        /// <summary>
        /// Grants access to a user with the specified label.
        /// </summary>
        public static string Label(string name)
        {
            return $"label:{name}";
        }
    }
}