import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class CompositeTypeModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('CompositeType', 'compositeTypes', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'CompositeTypeFilter', 'CompositeTypeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CompositeType',
            fieldName: 'compositeTypes',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('CompositeType', 'compositeTypes', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'CompositeTypeFilter', 'CompositeTypeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CompositeType',
            fieldName: 'compositeType',
            document,
            variables,
            transform: (data) => ({
                compositeType: data.compositeTypes?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('CompositeType', 'compositeTypes', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'CompositeTypeFilter', 'CompositeTypeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CompositeType',
            fieldName: 'compositeType',
            document,
            variables,
            transform: (data) => ({
                compositeType: data.compositeTypes?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('CompositeType', 'createCompositeType', 'compositeType', args.select, args.data, 'CreateCompositeTypeInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CompositeType',
            fieldName: 'createCompositeType',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('CompositeType', 'updateCompositeType', 'compositeType', args.select, args.where.id, args.data, 'UpdateCompositeTypeInput', 'id', 'compositeTypePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CompositeType',
            fieldName: 'updateCompositeType',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('CompositeType', 'deleteCompositeType', 'compositeType', {
            id: args.where.id,
        }, 'DeleteCompositeTypeInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CompositeType',
            fieldName: 'deleteCompositeType',
            document,
            variables,
        });
    }
}
