import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class ConnectedAccountsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('ConnectedAccountsModule', 'connectedAccountsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ConnectedAccountsModuleFilter', 'ConnectedAccountsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConnectedAccountsModule',
            fieldName: 'connectedAccountsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('ConnectedAccountsModule', 'connectedAccountsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'ConnectedAccountsModuleFilter', 'ConnectedAccountsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConnectedAccountsModule',
            fieldName: 'connectedAccountsModule',
            document,
            variables,
            transform: (data) => ({
                connectedAccountsModule: data.connectedAccountsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('ConnectedAccountsModule', 'connectedAccountsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'ConnectedAccountsModuleFilter', 'ConnectedAccountsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ConnectedAccountsModule',
            fieldName: 'connectedAccountsModule',
            document,
            variables,
            transform: (data) => ({
                connectedAccountsModule: data.connectedAccountsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('ConnectedAccountsModule', 'createConnectedAccountsModule', 'connectedAccountsModule', args.select, args.data, 'CreateConnectedAccountsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConnectedAccountsModule',
            fieldName: 'createConnectedAccountsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('ConnectedAccountsModule', 'updateConnectedAccountsModule', 'connectedAccountsModule', args.select, args.where.id, args.data, 'UpdateConnectedAccountsModuleInput', 'id', 'connectedAccountsModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConnectedAccountsModule',
            fieldName: 'updateConnectedAccountsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('ConnectedAccountsModule', 'deleteConnectedAccountsModule', 'connectedAccountsModule', {
            id: args.where.id,
        }, 'DeleteConnectedAccountsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ConnectedAccountsModule',
            fieldName: 'deleteConnectedAccountsModule',
            document,
            variables,
        });
    }
}
