// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.temp.notification.listNotifications

import (
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

const (
	TempNotificationListNotificationsNSID = "org.tangled.temp.notification.listNotifications"
)

// TempNotificationListNotifications_Notification is a "notification" in the org.tangled.temp.notification.listNotifications schema.
type TempNotificationListNotifications_Notification struct {
	// actorDid: DID of the user who triggered this notification.
	ActorDid string `json:"actorDid" cborgen:"actorDid"`
	// category: Broad category: 'social' or 'work'.
	Category  string `json:"category" cborgen:"category"`
	CreatedAt string `json:"createdAt" cborgen:"createdAt"`
	// issueAt: AT-URI of the related org.tangled.issue.issue record, if applicable.
	IssueAt *string `json:"issueAt,omitempty" cborgen:"issueAt,omitempty"`
	// pullAt: AT-URI of the related org.tangled.pulls.pull record, if applicable.
	PullAt *string `json:"pullAt,omitempty" cborgen:"pullAt,omitempty"`
	Read   bool    `json:"read" cborgen:"read"`
	// repoDid: DID of the related repository, if applicable.
	RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
	// type: Notification type: repo_starred, issue_created, issue_commented, issue_closed, issue_reopen, issue_assigned, issue_unassigned, pull_created, pull_commented, pull_merged, pull_closed, pull_reopen, pull_assigned, pull_unassigned, followed, user_mentioned, knot_invited, collaborator_invited.
	Type string `json:"type" cborgen:"type"`
	// uri: notification key; pass it back to updateSeen and deleteNotification.
	Uri string `json:"uri" cborgen:"uri"`
}

// TempNotificationListNotifications_Output is the output of a org.tangled.temp.notification.listNotifications call.
type TempNotificationListNotifications_Output struct {
	Cursor            *string                                           `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
	Notifications     []*TempNotificationListNotifications_Notification `json:"notifications" cborgen:"notifications"`
	SocialUnreadCount int64                                             `json:"socialUnreadCount" cborgen:"socialUnreadCount"`
	WorkUnreadCount   int64                                             `json:"workUnreadCount" cborgen:"workUnreadCount"`
}

// TempNotificationListNotifications calls the XRPC method "org.tangled.temp.notification.listNotifications".
//
// category: Filter by category: 'all', 'social', or 'work'.
// limit: Max notifications per category to return.
// read: Filter by read state: 'all' or 'unread'.
func TempNotificationListNotifications(ctx context.Context, c util.LexClient, category string, cursor string, limit int64, read string) (*TempNotificationListNotifications_Output, error) {
	var out TempNotificationListNotifications_Output

	params := map[string]interface{}{}
	if category != "" {
		params["category"] = category
	}
	if cursor != "" {
		params["cursor"] = cursor
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if read != "" {
		params["read"] = read
	}
	if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.notification.listNotifications", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
