import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgInviteModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgInvite', 'orgInvites', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgInviteFilter', 'OrgInviteOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgInvite',
            fieldName: 'orgInvites',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgInvite', 'orgInvites', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgInviteFilter', 'OrgInviteOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgInvite',
            fieldName: 'orgInvite',
            document,
            variables,
            transform: (data) => ({
                orgInvite: data.orgInvites?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgInvite', 'orgInvites', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgInviteFilter', 'OrgInviteOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgInvite',
            fieldName: 'orgInvite',
            document,
            variables,
            transform: (data) => ({
                orgInvite: data.orgInvites?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgInvite', 'createOrgInvite', 'orgInvite', args.select, args.data, 'CreateOrgInviteInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgInvite',
            fieldName: 'createOrgInvite',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgInvite', 'updateOrgInvite', 'orgInvite', args.select, args.where.id, args.data, 'UpdateOrgInviteInput', 'id', 'orgInvitePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgInvite',
            fieldName: 'updateOrgInvite',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgInvite', 'deleteOrgInvite', 'orgInvite', {
            id: args.where.id,
        }, 'DeleteOrgInviteInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgInvite',
            fieldName: 'deleteOrgInvite',
            document,
            variables,
        });
    }
}
