import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PhoneNumbersModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PhoneNumbersModule', 'phoneNumbersModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PhoneNumbersModuleFilter', 'PhoneNumbersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PhoneNumbersModule',
            fieldName: 'phoneNumbersModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PhoneNumbersModule', 'phoneNumbersModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PhoneNumbersModuleFilter', 'PhoneNumbersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PhoneNumbersModule',
            fieldName: 'phoneNumbersModule',
            document,
            variables,
            transform: (data) => ({
                phoneNumbersModule: data.phoneNumbersModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PhoneNumbersModule', 'phoneNumbersModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PhoneNumbersModuleFilter', 'PhoneNumbersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PhoneNumbersModule',
            fieldName: 'phoneNumbersModule',
            document,
            variables,
            transform: (data) => ({
                phoneNumbersModule: data.phoneNumbersModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PhoneNumbersModule', 'createPhoneNumbersModule', 'phoneNumbersModule', args.select, args.data, 'CreatePhoneNumbersModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PhoneNumbersModule',
            fieldName: 'createPhoneNumbersModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PhoneNumbersModule', 'updatePhoneNumbersModule', 'phoneNumbersModule', args.select, args.where.id, args.data, 'UpdatePhoneNumbersModuleInput', 'id', 'phoneNumbersModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PhoneNumbersModule',
            fieldName: 'updatePhoneNumbersModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PhoneNumbersModule', 'deletePhoneNumbersModule', 'phoneNumbersModule', {
            id: args.where.id,
        }, 'DeletePhoneNumbersModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PhoneNumbersModule',
            fieldName: 'deletePhoneNumbersModule',
            document,
            variables,
        });
    }
}
