import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class IntegrationProvidersModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('IntegrationProvidersModule', 'integrationProvidersModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'IntegrationProvidersModuleFilter', 'IntegrationProvidersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'IntegrationProvidersModule',
            fieldName: 'integrationProvidersModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('IntegrationProvidersModule', 'integrationProvidersModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'IntegrationProvidersModuleFilter', 'IntegrationProvidersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'IntegrationProvidersModule',
            fieldName: 'integrationProvidersModule',
            document,
            variables,
            transform: (data) => ({
                integrationProvidersModule: data.integrationProvidersModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('IntegrationProvidersModule', 'integrationProvidersModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'IntegrationProvidersModuleFilter', 'IntegrationProvidersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'IntegrationProvidersModule',
            fieldName: 'integrationProvidersModule',
            document,
            variables,
            transform: (data) => ({
                integrationProvidersModule: data.integrationProvidersModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('IntegrationProvidersModule', 'createIntegrationProvidersModule', 'integrationProvidersModule', args.select, args.data, 'CreateIntegrationProvidersModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'IntegrationProvidersModule',
            fieldName: 'createIntegrationProvidersModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('IntegrationProvidersModule', 'updateIntegrationProvidersModule', 'integrationProvidersModule', args.select, args.where.id, args.data, 'UpdateIntegrationProvidersModuleInput', 'id', 'integrationProvidersModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'IntegrationProvidersModule',
            fieldName: 'updateIntegrationProvidersModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('IntegrationProvidersModule', 'deleteIntegrationProvidersModule', 'integrationProvidersModule', {
            id: args.where.id,
        }, 'DeleteIntegrationProvidersModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'IntegrationProvidersModule',
            fieldName: 'deleteIntegrationProvidersModule',
            document,
            variables,
        });
    }
}
