import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class EmailsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('EmailsModule', 'emailsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'EmailsModuleFilter', 'EmailsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'EmailsModule',
            fieldName: 'emailsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('EmailsModule', 'emailsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'EmailsModuleFilter', 'EmailsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'EmailsModule',
            fieldName: 'emailsModule',
            document,
            variables,
            transform: (data) => ({
                emailsModule: data.emailsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('EmailsModule', 'emailsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'EmailsModuleFilter', 'EmailsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'EmailsModule',
            fieldName: 'emailsModule',
            document,
            variables,
            transform: (data) => ({
                emailsModule: data.emailsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('EmailsModule', 'createEmailsModule', 'emailsModule', args.select, args.data, 'CreateEmailsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'EmailsModule',
            fieldName: 'createEmailsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('EmailsModule', 'updateEmailsModule', 'emailsModule', args.select, args.where.id, args.data, 'UpdateEmailsModuleInput', 'id', 'emailsModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'EmailsModule',
            fieldName: 'updateEmailsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('EmailsModule', 'deleteEmailsModule', 'emailsModule', {
            id: args.where.id,
        }, 'DeleteEmailsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'EmailsModule',
            fieldName: 'deleteEmailsModule',
            document,
            variables,
        });
    }
}
