import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class ConfigSecretsUserModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('ConfigSecretsUserModule', 'configSecretsUserModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ConfigSecretsUserModuleFilter', 'ConfigSecretsUserModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConfigSecretsUserModule',
            fieldName: 'configSecretsUserModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('ConfigSecretsUserModule', 'configSecretsUserModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'ConfigSecretsUserModuleFilter', 'ConfigSecretsUserModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConfigSecretsUserModule',
            fieldName: 'configSecretsUserModule',
            document,
            variables,
            transform: (data) => ({
                configSecretsUserModule: data.configSecretsUserModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('ConfigSecretsUserModule', 'configSecretsUserModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'ConfigSecretsUserModuleFilter', 'ConfigSecretsUserModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConfigSecretsUserModule',
            fieldName: 'configSecretsUserModule',
            document,
            variables,
            transform: (data) => ({
                configSecretsUserModule: data.configSecretsUserModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('ConfigSecretsUserModule', 'createConfigSecretsUserModule', 'configSecretsUserModule', args.select, args.data, 'CreateConfigSecretsUserModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConfigSecretsUserModule',
            fieldName: 'createConfigSecretsUserModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('ConfigSecretsUserModule', 'updateConfigSecretsUserModule', 'configSecretsUserModule', args.select, args.where.id, args.data, 'UpdateConfigSecretsUserModuleInput', 'id', 'configSecretsUserModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConfigSecretsUserModule',
            fieldName: 'updateConfigSecretsUserModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('ConfigSecretsUserModule', 'deleteConfigSecretsUserModule', 'configSecretsUserModule', {
            id: args.where.id,
        }, 'DeleteConfigSecretsUserModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConfigSecretsUserModule',
            fieldName: 'deleteConfigSecretsUserModule',
            document,
            variables,
        });
    }
}
