import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class InvitesModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('InvitesModule', 'invitesModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'InvitesModuleFilter', 'InvitesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InvitesModule',
            fieldName: 'invitesModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('InvitesModule', 'invitesModules', args.select, {
            where: args?.where,
        }, 'InvitesModuleFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InvitesModule',
            fieldName: 'invitesModules',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('InvitesModule', 'invitesModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'InvitesModuleFilter', 'InvitesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'InvitesModule',
            fieldName: 'invitesModule',
            document,
            variables,
            transform: (data) => ({
                invitesModule: data.invitesModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('InvitesModule', 'createInvitesModule', 'invitesModule', args.select, args.data, 'CreateInvitesModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InvitesModule',
            fieldName: 'createInvitesModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('InvitesModule', 'updateInvitesModule', 'invitesModule', args.select, args.where.id, args.data, 'UpdateInvitesModuleInput', 'id', 'invitesModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InvitesModule',
            fieldName: 'updateInvitesModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('InvitesModule', 'deleteInvitesModule', 'invitesModule', {
            id: args.where.id,
        }, 'DeleteInvitesModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'InvitesModule',
            fieldName: 'deleteInvitesModule',
            document,
            variables,
        });
    }
}
