import { definePlugin } from "../../utils/plugin-utils";
import { createPluginMethod } from "../../utils/plugin-utils";
import { DeleteClientCredentialsSchema } from "./schemas";
import { clientIdResolver } from "../../resolvers";
export const deleteClientCredentialsPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
    name: "deleteClientCredentials",
    categories: ["client-credentials"],
    type: "delete",
    itemType: "ClientCredentials",
    inputSchema: DeleteClientCredentialsSchema,
    resolvers: { clientId: clientIdResolver },
    handler: async ({ sdk, options }) => {
        const { api } = sdk.context;
        await api.delete(`/api/v0/client-credentials/${options.clientId}`, undefined, {
            authRequired: true,
            requiredScopes: ["credentials"],
            resource: {
                type: "client-credential",
                id: options.clientId,
            },
        });
        return { success: true };
    },
}));
