"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlatformWebhookEventModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class PlatformWebhookEventModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.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', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'platformWebhookEvents',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('PlatformWebhookEvent', 'platformWebhookEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformWebhookEventFilter', 'PlatformWebhookEventOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.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 } = (0, query_builder_1.buildFindManyDocument)('PlatformWebhookEvent', 'platformWebhookEvents', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformWebhookEventFilter', 'PlatformWebhookEventOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.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 } = (0, query_builder_1.buildCreateDocument)('PlatformWebhookEvent', 'createPlatformWebhookEvent', 'platformWebhookEvent', args.select, args.data, 'CreatePlatformWebhookEventInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'createPlatformWebhookEvent',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('PlatformWebhookEvent', 'updatePlatformWebhookEvent', 'platformWebhookEvent', args.select, args.where.id, args.data, 'UpdatePlatformWebhookEventInput', 'id', 'platformWebhookEventPatch', input_types_1.connectionFieldsMap, undefined);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'updatePlatformWebhookEvent',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('PlatformWebhookEvent', 'deletePlatformWebhookEvent', 'platformWebhookEvent', {
            id: args.where.id,
        }, 'DeletePlatformWebhookEventInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformWebhookEvent',
            fieldName: 'deletePlatformWebhookEvent',
            document,
            variables,
        });
    }
}
exports.PlatformWebhookEventModel = PlatformWebhookEventModel;
