"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebauthnAuthModuleModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class WebauthnAuthModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('WebauthnAuthModule', 'webauthnAuthModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnAuthModule',
            fieldName: 'webauthnAuthModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('WebauthnAuthModule', 'webauthnAuthModules', args.select, {
            where: args?.where,
        }, 'WebauthnAuthModuleFilter', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnAuthModule',
            fieldName: 'webauthnAuthModules',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('WebauthnAuthModule', 'webauthnAuthModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnAuthModule',
            fieldName: 'webauthnAuthModule',
            document,
            variables,
            transform: (data) => ({
                webauthnAuthModule: data.webauthnAuthModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('WebauthnAuthModule', 'createWebauthnAuthModule', 'webauthnAuthModule', args.select, args.data, 'CreateWebauthnAuthModuleInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnAuthModule',
            fieldName: 'createWebauthnAuthModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('WebauthnAuthModule', 'updateWebauthnAuthModule', 'webauthnAuthModule', args.select, args.where.id, args.data, 'UpdateWebauthnAuthModuleInput', 'id', 'webauthnAuthModulePatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnAuthModule',
            fieldName: 'updateWebauthnAuthModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('WebauthnAuthModule', 'deleteWebauthnAuthModule', 'webauthnAuthModule', {
            id: args.where.id,
        }, 'DeleteWebauthnAuthModuleInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnAuthModule',
            fieldName: 'deleteWebauthnAuthModule',
            document,
            variables,
        });
    }
}
exports.WebauthnAuthModuleModel = WebauthnAuthModuleModel;
