import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class UserConnectedAccountModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('UserConnectedAccount', 'userConnectedAccounts', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'UserConnectedAccountFilter', 'UserConnectedAccountOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserConnectedAccount',
            fieldName: 'userConnectedAccounts',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('UserConnectedAccount', 'userConnectedAccounts', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'UserConnectedAccountFilter', 'UserConnectedAccountOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserConnectedAccount',
            fieldName: 'userConnectedAccount',
            document,
            variables,
            transform: (data) => ({
                userConnectedAccount: data.userConnectedAccounts?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('UserConnectedAccount', 'userConnectedAccounts', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'UserConnectedAccountFilter', 'UserConnectedAccountOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'UserConnectedAccount',
            fieldName: 'userConnectedAccount',
            document,
            variables,
            transform: (data) => ({
                userConnectedAccount: data.userConnectedAccounts?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('UserConnectedAccount', 'createUserConnectedAccount', 'userConnectedAccount', args.select, args.data, 'CreateUserConnectedAccountInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'UserConnectedAccount',
            fieldName: 'createUserConnectedAccount',
            document,
            variables,
        });
    }
}
