import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class WebhookModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('WebhookModule', 'webhookModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'WebhookModuleFilter', 'WebhookModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebhookModule',
            fieldName: 'webhookModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('WebhookModule', 'webhookModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'WebhookModuleFilter', 'WebhookModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebhookModule',
            fieldName: 'webhookModule',
            document,
            variables,
            transform: (data) => ({
                webhookModule: data.webhookModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('WebhookModule', 'webhookModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'WebhookModuleFilter', 'WebhookModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebhookModule',
            fieldName: 'webhookModule',
            document,
            variables,
            transform: (data) => ({
                webhookModule: data.webhookModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('WebhookModule', 'createWebhookModule', 'webhookModule', args.select, args.data, 'CreateWebhookModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebhookModule',
            fieldName: 'createWebhookModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('WebhookModule', 'updateWebhookModule', 'webhookModule', args.select, args.where.id, args.data, 'UpdateWebhookModuleInput', 'id', 'webhookModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebhookModule',
            fieldName: 'updateWebhookModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('WebhookModule', 'deleteWebhookModule', 'webhookModule', {
            id: args.where.id,
        }, 'DeleteWebhookModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebhookModule',
            fieldName: 'deleteWebhookModule',
            document,
            variables,
        });
    }
}
