// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// Sub-schema: inviteManagement — Actions related to creating, fetching, and managing invites.
// Auto-generated by the onboarding scaffolder.

export type InviteManagementActions =
    | GetInviteAction
    | DeleteInviteAction
    | GetTargetUsersAction
    | UpdateTargetUsersAction
    | GetTargetUsersJobStatusAction
    | GetChannelInvitesAction
    | CreateChannelInviteAction;

// Returns an invite object for the given code.
// Sample phrases:
//   - "Can you fetch the invite details for the code ABC123?"
//   - "I need the invite info for code XYZ789, please."
//   - "Get me the invite object for the code DEF456, and include the counts."
export type GetInviteAction = {
    actionName: "getInvite";
    parameters: {
        // The code of the invite to fetch.
        invite_code: string;
        // Whether to include member counts.
        with_counts?: boolean;
        // The ID of the scheduled event for the invite.
        guild_scheduled_event_id?: string;
    };
};

// Delete an invite. Requires the MANAGE_CHANNELS permission on the channel this invite belongs to, or MANAGE_GUILD to remove any invite across the guild.
// Sample phrases:
//   - "Can you delete the invite with code ABC123?"
//   - "Please remove the invite link with the code XYZ789."
//   - "I need you to delete the invite that has the code LMN456."
export type DeleteInviteAction = {
    actionName: "deleteInvite";
    parameters: {
        // The code of the invite to delete.
        invite_code: string;
    };
};

// Gets the users allowed to see and accept this invite. Response is a CSV file with the header user_id and each user ID from the original file passed to invite create on its own line. Requires the caller to be the inviter, or have MANAGE_GUILD permission, or have VIEW_AUDIT_LOG permission.
// Sample phrases:
//   - "Can you show me the list of users who can accept this invite?"
//   - "Get me the users allowed to see this invite, please."
//   - "I need the user IDs for the invite with code [invite.code]."
export type GetTargetUsersAction = {
    actionName: "getTargetUsers";
    parameters: {
        // The code of the invite to fetch target users for.
        invite_code: string;
    };
};

// Updates the users allowed to see and accept this invite. Uploading a file with invalid user IDs will result in a 400 with the invalid IDs described. Requires the caller to be the inviter or have the MANAGE_GUILD permission.
// Sample phrases:
//   - "Can you update the invite with these new target users? Here's the file."
//   - "Please refresh the list of users who can access this invite using this file."
//   - "I'd like to change the allowed users for this invite. Uploading the file now."
export type UpdateTargetUsersAction = {
    actionName: "updateTargetUsers";
    parameters: {
        // The code of the invite to update target users for.
        invite_code: string;
        // The file containing the new target users (file path or URL).
        target_users_file?: string;
    };
};

// Processing target users from a CSV when creating or updating an invite is done asynchronously. This endpoint allows you to check the status of that job. Requires the caller to be the inviter, or have MANAGE_GUILD permission, or have VIEW_AUDIT_LOG permission.
// Sample phrases:
//   - "Can you check the status of the job for the invite with code ABC123?"
//   - "What's the current status of the processing job for the invite code ABC123?"
//   - "Please tell me the job status for the invite code ABC123."
export type GetTargetUsersJobStatusAction = {
    actionName: "getTargetUsersJobStatus";
    parameters: {
        // The code of the invite to check the job status for.
        invite_code: string;
    };
};

// Get all invites for a channel.
export type GetChannelInvitesAction = {
    actionName: "getChannelInvites";
    parameters: {
        // The ID of the channel.
        channel_id: string;
    };
};

// Create a new invite for a channel.
export type CreateChannelInviteAction = {
    actionName: "createChannelInvite";
    parameters: {
        // The ID of the channel.
        channel_id: string;
        // Duration of invite in seconds (0 = never expires).
        max_age?: number;
        // Max number of uses (0 = unlimited).
        max_uses?: number;
        // Whether the invite is temporary.
        temporary?: boolean;
        // Whether the invite is unique.
        unique?: boolean;
    };
};
