import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformWebhookEventModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformWebhookEvent', 'platformWebhookEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformWebhookEventFilter', 'PlatformWebhookEventOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'platformWebhookEvents',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformWebhookEvent', 'platformWebhookEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformWebhookEventFilter', 'PlatformWebhookEventOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'platformWebhookEvent',
            document,
            variables,
            transform: (data) => ({
                platformWebhookEvent: data.platformWebhookEvents?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformWebhookEvent', 'platformWebhookEvents', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformWebhookEventFilter', 'PlatformWebhookEventOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'platformWebhookEvent',
            document,
            variables,
            transform: (data) => ({
                platformWebhookEvent: data.platformWebhookEvents?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformWebhookEvent', 'createPlatformWebhookEvent', 'platformWebhookEvent', args.select, args.data, 'CreatePlatformWebhookEventInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'createPlatformWebhookEvent',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformWebhookEvent', 'updatePlatformWebhookEvent', 'platformWebhookEvent', args.select, args.where.id, args.data, 'UpdatePlatformWebhookEventInput', 'id', 'platformWebhookEventPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'updatePlatformWebhookEvent',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformWebhookEvent', 'deletePlatformWebhookEvent', 'platformWebhookEvent', {
            id: args.where.id,
        }, 'DeletePlatformWebhookEventInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'deletePlatformWebhookEvent',
            document,
            variables,
        });
    }
}
