# shellcheck shell=bash
# https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user
___x_cmd_gh_notification_ll() {

      param:scope     ___x_cmd_gh
    param:dsl       '
options:
    --all               "show notifications marked as read"                                                  <>:Boolean="false"
    --participating     "shows notifications in which the user is directly participating or mentioned"       <>:Boolean="false"
    --since             "show results that were last updated after the given time"                           <>:ISOTime=""
    --before            "show notifications updated before the given time"                                   <>:ISOTime=""

    --per_page          "Results per page"                                                                   <>:Numbers="30"
    --page              "Page number of the results to fetch."                                               <>:Numbers="1"

    --json|-j           "output origin json data"
    --csv               "output csv data"
    --yml               "output yml data"
'
    param:run

    if ___x_cmd_gx_output_is_format; then
        ___x_cmd_gh_notification_ll___raw| ___x_cmd_gx_output_format
    else
        ___x_cmd_gh_notification_ll___raw |\
            ___x_cmd jo 2c .id .repository.full_name .unread .subject.title |\
            ___x_cmd csv header --add ID  Repo  Unread Title | \
            if [ -n "$csv" ]; then  ___x_cmd_cmds cat
            else                    ___x_cmd csv static_tab
            fi
    fi
}

___x_cmd_gh_notification_ll___raw(){
    ___x_cmd_gh_get_multi "/notifications" per_page page  all since before participating
}