import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AppInviteModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AppInvite', 'appInvites', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AppInviteFilter', 'AppInviteOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppInvite',
            fieldName: 'appInvites',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AppInvite', 'appInvites', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AppInviteFilter', 'AppInviteOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppInvite',
            fieldName: 'appInvite',
            document,
            variables,
            transform: (data) => ({
                appInvite: data.appInvites?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AppInvite', 'appInvites', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AppInviteFilter', 'AppInviteOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppInvite',
            fieldName: 'appInvite',
            document,
            variables,
            transform: (data) => ({
                appInvite: data.appInvites?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AppInvite', 'createAppInvite', 'appInvite', args.select, args.data, 'CreateAppInviteInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppInvite',
            fieldName: 'createAppInvite',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AppInvite', 'updateAppInvite', 'appInvite', args.select, args.where.id, args.data, 'UpdateAppInviteInput', 'id', 'appInvitePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppInvite',
            fieldName: 'updateAppInvite',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AppInvite', 'deleteAppInvite', 'appInvite', {
            id: args.where.id,
        }, 'DeleteAppInviteInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppInvite',
            fieldName: 'deleteAppInvite',
            document,
            variables,
        });
    }
}
