import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class WebauthnCredentialsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('WebauthnCredentialsModule', 'webauthnCredentialsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'WebauthnCredentialsModuleFilter', 'WebauthnCredentialsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnCredentialsModule',
            fieldName: 'webauthnCredentialsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('WebauthnCredentialsModule', 'webauthnCredentialsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'WebauthnCredentialsModuleFilter', 'WebauthnCredentialsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnCredentialsModule',
            fieldName: 'webauthnCredentialsModule',
            document,
            variables,
            transform: (data) => ({
                webauthnCredentialsModule: data.webauthnCredentialsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('WebauthnCredentialsModule', 'webauthnCredentialsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'WebauthnCredentialsModuleFilter', 'WebauthnCredentialsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'WebauthnCredentialsModule',
            fieldName: 'webauthnCredentialsModule',
            document,
            variables,
            transform: (data) => ({
                webauthnCredentialsModule: data.webauthnCredentialsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('WebauthnCredentialsModule', 'createWebauthnCredentialsModule', 'webauthnCredentialsModule', args.select, args.data, 'CreateWebauthnCredentialsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnCredentialsModule',
            fieldName: 'createWebauthnCredentialsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('WebauthnCredentialsModule', 'updateWebauthnCredentialsModule', 'webauthnCredentialsModule', args.select, args.where.id, args.data, 'UpdateWebauthnCredentialsModuleInput', 'id', 'webauthnCredentialsModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnCredentialsModule',
            fieldName: 'updateWebauthnCredentialsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('WebauthnCredentialsModule', 'deleteWebauthnCredentialsModule', 'webauthnCredentialsModule', {
            id: args.where.id,
        }, 'DeleteWebauthnCredentialsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'WebauthnCredentialsModule',
            fieldName: 'deleteWebauthnCredentialsModule',
            document,
            variables,
        });
    }
}
