import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class HierarchyModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('HierarchyModule', 'hierarchyModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'HierarchyModuleFilter', 'HierarchyModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'HierarchyModule',
            fieldName: 'hierarchyModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('HierarchyModule', 'hierarchyModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'HierarchyModuleFilter', 'HierarchyModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'HierarchyModule',
            fieldName: 'hierarchyModule',
            document,
            variables,
            transform: (data) => ({
                hierarchyModule: data.hierarchyModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('HierarchyModule', 'hierarchyModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'HierarchyModuleFilter', 'HierarchyModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'HierarchyModule',
            fieldName: 'hierarchyModule',
            document,
            variables,
            transform: (data) => ({
                hierarchyModule: data.hierarchyModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('HierarchyModule', 'createHierarchyModule', 'hierarchyModule', args.select, args.data, 'CreateHierarchyModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'HierarchyModule',
            fieldName: 'createHierarchyModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('HierarchyModule', 'updateHierarchyModule', 'hierarchyModule', args.select, args.where.id, args.data, 'UpdateHierarchyModuleInput', 'id', 'hierarchyModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'HierarchyModule',
            fieldName: 'updateHierarchyModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('HierarchyModule', 'deleteHierarchyModule', 'hierarchyModule', {
            id: args.where.id,
        }, 'DeleteHierarchyModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'HierarchyModule',
            fieldName: 'deleteHierarchyModule',
            document,
            variables,
        });
    }
}
