# retoor <retoor@molodetz.nl>

from __future__ import annotations

from ..spec import Action
from ._shared import ATTACHMENTS, TARGET_TYPE, body, confirm, path


COMMENTS_ACTIONS: tuple[Action, ...] = (
    Action(
        name="create_comment",
        method="POST",
        path="/comments/create",
        summary="Create a comment on a post or other target",
        params=(
            body("content", "Comment body.", required=True),
            body("post_uid", "Uid of the post being commented on."),
            body("target_uid", "Uid of the target when not a post."),
            body("target_type", TARGET_TYPE),
            body("parent_uid", "Parent comment uid for replies."),
            body("attachment_uids", ATTACHMENTS),
        ),
    ),
    Action(
        name="edit_comment",
        method="POST",
        path="/comments/edit/{comment_uid}",
        summary="Edit the body of one of your own comments",
        params=(
            path("comment_uid", "Uid of the comment."),
            body("content", "New comment body, 3-125000 characters.", required=True),
        ),
    ),
    Action(
        name="delete_comment",
        method="POST",
        path="/comments/delete/{comment_uid}",
        summary="Delete a comment (your own, or any comment when you are an administrator). Soft delete, confirmation required",
        params=(path("comment_uid", "Uid of the comment."), confirm()),
    ),
)
