"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LevelsModuleModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class LevelsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('LevelsModule', 'levelsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'LevelsModuleFilter', 'LevelsModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LevelsModule',
            fieldName: 'levelsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('LevelsModule', 'levelsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'LevelsModuleFilter', 'LevelsModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LevelsModule',
            fieldName: 'levelsModule',
            document,
            variables,
            transform: (data) => ({
                levelsModule: data.levelsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('LevelsModule', 'levelsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'LevelsModuleFilter', 'LevelsModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LevelsModule',
            fieldName: 'levelsModule',
            document,
            variables,
            transform: (data) => ({
                levelsModule: data.levelsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('LevelsModule', 'createLevelsModule', 'levelsModule', args.select, args.data, 'CreateLevelsModuleInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LevelsModule',
            fieldName: 'createLevelsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('LevelsModule', 'updateLevelsModule', 'levelsModule', args.select, args.where.id, args.data, 'UpdateLevelsModuleInput', 'id', 'levelsModulePatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LevelsModule',
            fieldName: 'updateLevelsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('LevelsModule', 'deleteLevelsModule', 'levelsModule', {
            id: args.where.id,
        }, 'DeleteLevelsModuleInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LevelsModule',
            fieldName: 'deleteLevelsModule',
            document,
            variables,
        });
    }
}
exports.LevelsModuleModel = LevelsModuleModel;
