import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class EntityTypeProvisionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('EntityTypeProvision', 'entityTypeProvisions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'EntityTypeProvisionFilter', 'EntityTypeProvisionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'EntityTypeProvision',
            fieldName: 'entityTypeProvisions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('EntityTypeProvision', 'entityTypeProvisions', args.select, {
            where: args?.where,
        }, 'EntityTypeProvisionFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'EntityTypeProvision',
            fieldName: 'entityTypeProvisions',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('EntityTypeProvision', 'entityTypeProvisions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'EntityTypeProvisionFilter', 'EntityTypeProvisionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'EntityTypeProvision',
            fieldName: 'entityTypeProvision',
            document,
            variables,
            transform: (data) => ({
                entityTypeProvision: data.entityTypeProvisions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('EntityTypeProvision', 'createEntityTypeProvision', 'entityTypeProvision', args.select, args.data, 'CreateEntityTypeProvisionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'EntityTypeProvision',
            fieldName: 'createEntityTypeProvision',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('EntityTypeProvision', 'updateEntityTypeProvision', 'entityTypeProvision', args.select, args.where.id, args.data, 'UpdateEntityTypeProvisionInput', 'id', 'entityTypeProvisionPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'EntityTypeProvision',
            fieldName: 'updateEntityTypeProvision',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('EntityTypeProvision', 'deleteEntityTypeProvision', 'entityTypeProvision', {
            id: args.where.id,
        }, 'DeleteEntityTypeProvisionInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'EntityTypeProvision',
            fieldName: 'deleteEntityTypeProvision',
            document,
            variables,
        });
    }
}
