import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class LevelsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = 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', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LevelsModule',
            fieldName: 'levelsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('LevelsModule', 'levelsModules', args.select, {
            where: args?.where,
        }, 'LevelsModuleFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LevelsModule',
            fieldName: 'levelsModules',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('LevelsModule', 'levelsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'LevelsModuleFilter', 'LevelsModuleOrderBy', connectionFieldsMap);
        return new 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 } = buildCreateDocument('LevelsModule', 'createLevelsModule', 'levelsModule', args.select, args.data, 'CreateLevelsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LevelsModule',
            fieldName: 'createLevelsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('LevelsModule', 'updateLevelsModule', 'levelsModule', args.select, args.where.id, args.data, 'UpdateLevelsModuleInput', 'id', 'levelsModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LevelsModule',
            fieldName: 'updateLevelsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('LevelsModule', 'deleteLevelsModule', 'levelsModule', {
            id: args.where.id,
        }, 'DeleteLevelsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LevelsModule',
            fieldName: 'deleteLevelsModule',
            document,
            variables,
        });
    }
}
