import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class UserCredentialsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('UserCredentialsModule', 'userCredentialsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'UserCredentialsModuleFilter', 'UserCredentialsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserCredentialsModule',
            fieldName: 'userCredentialsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('UserCredentialsModule', 'userCredentialsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'UserCredentialsModuleFilter', 'UserCredentialsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserCredentialsModule',
            fieldName: 'userCredentialsModule',
            document,
            variables,
            transform: (data) => ({
                userCredentialsModule: data.userCredentialsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('UserCredentialsModule', 'userCredentialsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'UserCredentialsModuleFilter', 'UserCredentialsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserCredentialsModule',
            fieldName: 'userCredentialsModule',
            document,
            variables,
            transform: (data) => ({
                userCredentialsModule: data.userCredentialsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('UserCredentialsModule', 'createUserCredentialsModule', 'userCredentialsModule', args.select, args.data, 'CreateUserCredentialsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserCredentialsModule',
            fieldName: 'createUserCredentialsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('UserCredentialsModule', 'updateUserCredentialsModule', 'userCredentialsModule', args.select, args.where.id, args.data, 'UpdateUserCredentialsModuleInput', 'id', 'userCredentialsModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserCredentialsModule',
            fieldName: 'updateUserCredentialsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('UserCredentialsModule', 'deleteUserCredentialsModule', 'userCredentialsModule', {
            id: args.where.id,
        }, 'DeleteUserCredentialsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserCredentialsModule',
            fieldName: 'deleteUserCredentialsModule',
            document,
            variables,
        });
    }
}
