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

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

export type ChannelManagementActions =
    | GetChannelAction
    | ModifyChannelAction
    | SetVoiceChannelStatusAction
    | DeleteChannelAction
    | EditChannelPermissionsAction
    | DeleteChannelPermissionAction
    | FollowAnnouncementChannelAction
    | CreateDMAction
    | CreateGroupDMAction
    | GroupDmAddRecipientAction
    | GroupDmRemoveRecipientAction;

// Get a channel by ID. Returns a channel object.
export type GetChannelAction = {
    actionName: "getChannel";
    parameters: {
        // The ID of the channel to fetch.
        channel_id: string;
    };
};

// Update a channel's settings.
export type ModifyChannelAction = {
    actionName: "modifyChannel";
    parameters: {
        // The ID of the channel to modify.
        channel_id: string;
        // The new name for the channel.
        name?: string;
        // The new topic for the channel.
        topic?: string;
        // Whether the channel is NSFW.
        nsfw?: boolean;
    };
};

// Set the status of a voice channel.
export type SetVoiceChannelStatusAction = {
    actionName: "setVoiceChannelStatus";
    parameters: {
        // The ID of the voice channel.
        channel_id: string;
        // The new status for the voice channel.
        status: string;
    };
};

// Delete a channel or close a private message.
export type DeleteChannelAction = {
    actionName: "deleteChannel";
    parameters: {
        // The ID of the channel to delete.
        channel_id: string;
    };
};

// Edit the permissions of a channel.
export type EditChannelPermissionsAction = {
    actionName: "editChannelPermissions";
    parameters: {
        // The ID of the channel.
        channel_id: string;
        // The ID of the overwrite (user or role).
        overwrite_id?: string;
        // The allow permission bitfield.
        allow?: string;
        // The deny permission bitfield.
        deny?: string;
        // The type of the overwrite (0 = role, 1 = member).
        type?: number;
    };
};

// Delete a permission overwrite from a channel.
export type DeleteChannelPermissionAction = {
    actionName: "deleteChannelPermission";
    parameters: {
        // The ID of the channel.
        channel_id: string;
        // The ID of the overwrite to delete.
        overwrite_id: string;
    };
};

// Follow an announcement channel to receive crossposted messages.
export type FollowAnnouncementChannelAction = {
    actionName: "followAnnouncementChannel";
    parameters: {
        // The ID of the announcement channel to follow.
        channel_id: string;
        // The ID of the channel to receive crossposted messages.
        webhook_channel_id: string;
    };
};

// Create a new DM channel with a user. Returns a DM channel object.
// Sample phrases:
//   - "Can you start a direct message with user ID 123456?"
//   - "I'd like to create a DM channel with the user whose ID is 123456."
//   - "Please open a new DM with the user having the ID 123456."
export type CreateDMAction = {
    actionName: "createDM";
    parameters: {
        // The ID of the recipient user.
        recipient_id: string;
    };
};

// Create a new group DM channel with multiple users. Returns a DM channel object.
// Sample phrases:
//   - "Can you start a new group DM with these friends?"
//   - "Create a group chat with these people, please."
//   - "I'd like to set up a group DM with my buddies."
export type CreateGroupDMAction = {
    actionName: "createGroupDM";
    parameters?: {
        // The access tokens for the users to be added to the group DM.
        access_tokens?: string[];
        // Comma-separated nickname mappings (e.g. "userId1:nick1,userId2:nick2").
        nicks?: string;
    };
};

// Add a recipient to a Group DM.
export type GroupDmAddRecipientAction = {
    actionName: "groupDmAddRecipient";
    parameters: {
        // The ID of the group DM channel.
        channel_id: string;
        // The ID of the user to add.
        user_id: string;
        // The access token of the user.
        access_token?: string;
        // The nickname for the user in the group DM.
        nick?: string;
    };
};

// Remove a recipient from a Group DM.
export type GroupDmRemoveRecipientAction = {
    actionName: "groupDmRemoveRecipient";
    parameters: {
        // The ID of the group DM channel.
        channel_id: string;
        // The ID of the user to remove.
        user_id: string;
    };
};
