import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgChartEdgeModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgChartEdge', 'orgChartEdges', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgChartEdgeFilter', 'OrgChartEdgeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgChartEdge',
            fieldName: 'orgChartEdges',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgChartEdge', 'orgChartEdges', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgChartEdgeFilter', 'OrgChartEdgeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgChartEdge',
            fieldName: 'orgChartEdge',
            document,
            variables,
            transform: (data) => ({
                orgChartEdge: data.orgChartEdges?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgChartEdge', 'orgChartEdges', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgChartEdgeFilter', 'OrgChartEdgeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgChartEdge',
            fieldName: 'orgChartEdge',
            document,
            variables,
            transform: (data) => ({
                orgChartEdge: data.orgChartEdges?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgChartEdge', 'createOrgChartEdge', 'orgChartEdge', args.select, args.data, 'CreateOrgChartEdgeInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgChartEdge',
            fieldName: 'createOrgChartEdge',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgChartEdge', 'updateOrgChartEdge', 'orgChartEdge', args.select, args.where.id, args.data, 'UpdateOrgChartEdgeInput', 'id', 'orgChartEdgePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgChartEdge',
            fieldName: 'updateOrgChartEdge',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgChartEdge', 'deleteOrgChartEdge', 'orgChartEdge', {
            id: args.where.id,
        }, 'DeleteOrgChartEdgeInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgChartEdge',
            fieldName: 'deleteOrgChartEdge',
            document,
            variables,
        });
    }
}
