# retoor <retoor@molodetz.nl>

from __future__ import annotations

from ..spec import Action
from ._shared import confirm, path, query


SOCIAL_ACTIONS: tuple[Action, ...] = (
    Action(
        name="follow_user",
        method="POST",
        path="/follow/{username}",
        summary="Follow a user",
        params=(path("username", "Username to follow."),),
    ),
    Action(
        name="unfollow_user",
        method="POST",
        path="/follow/unfollow/{username}",
        summary="Unfollow a user",
        params=(path("username", "Username to unfollow."),),
    ),
    Action(
        name="block_user",
        method="POST",
        path="/block/{username}",
        summary="Block a user so their posts, comments and messages are hidden and they cannot notify you",
        params=(path("username", "Username to block."),),
    ),
    Action(
        name="unblock_user",
        method="POST",
        path="/block/unblock/{username}",
        summary="Unblock a user",
        params=(path("username", "Username to unblock."),),
    ),
    Action(
        name="mute_user",
        method="POST",
        path="/mute/{username}",
        summary="Mute a user so they can no longer create notifications for you",
        params=(path("username", "Username to mute."),),
    ),
    Action(
        name="unmute_user",
        method="POST",
        path="/mute/unmute/{username}",
        summary="Unmute a user",
        params=(path("username", "Username to unmute."),),
    ),
    Action(
        name="list_followers",
        method="GET",
        path="/profile/{username}/followers",
        summary="List the users who follow a profile",
        requires_auth=False,
        params=(
            path("username", "Username whose followers to list."),
            query("page", "Page number, 25 per page."),
        ),
    ),
    Action(
        name="list_following",
        method="GET",
        path="/profile/{username}/following",
        summary="List the users a profile follows",
        requires_auth=False,
        params=(
            path("username", "Username whose following to list."),
            query("page", "Page number, 25 per page."),
        ),
    ),
    Action(
        name="list_media",
        method="GET",
        path="/profile/{username}",
        summary="List a user's uploaded media, newest first",
        requires_auth=False,
        params=(
            path("username", "Username whose media to list."),
            query("tab", "Profile tab (defaults to media for this action)."),
            query("page", "Page number, 24 per page."),
        ),
    ),
    Action(
        name="delete_media",
        method="POST",
        path="/media/{uid}/delete",
        summary="Delete an uploaded media attachment (your own, or anyone's when you are an administrator)",
        description=(
            "Removes the attachment from the user's Media tab and from any post, project, or "
            "gist where it was attached. Soft delete (restorable from admin trash). Show the user "
            "the exact media, get explicit confirmation, then call again with confirm=true."
        ),
        requires_auth=True,
        params=(path("uid", "Attachment uid to delete."), confirm()),
    ),
    Action(
        name="view_leaderboard",
        method="GET",
        path="/leaderboard",
        summary="View the leaderboard",
        requires_auth=False,
    ),
)
