import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class UserAuthModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('UserAuthModule', 'userAuthModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'UserAuthModuleFilter', 'UserAuthModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserAuthModule',
            fieldName: 'userAuthModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('UserAuthModule', 'userAuthModules', args.select, {
            where: args?.where,
        }, 'UserAuthModuleFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserAuthModule',
            fieldName: 'userAuthModules',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('UserAuthModule', 'userAuthModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'UserAuthModuleFilter', 'UserAuthModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserAuthModule',
            fieldName: 'userAuthModule',
            document,
            variables,
            transform: (data) => ({
                userAuthModule: data.userAuthModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('UserAuthModule', 'createUserAuthModule', 'userAuthModule', args.select, args.data, 'CreateUserAuthModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserAuthModule',
            fieldName: 'createUserAuthModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('UserAuthModule', 'updateUserAuthModule', 'userAuthModule', args.select, args.where.id, args.data, 'UpdateUserAuthModuleInput', 'id', 'userAuthModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserAuthModule',
            fieldName: 'updateUserAuthModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('UserAuthModule', 'deleteUserAuthModule', 'userAuthModule', {
            id: args.where.id,
        }, 'DeleteUserAuthModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserAuthModule',
            fieldName: 'deleteUserAuthModule',
            document,
            variables,
        });
    }
}
