import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformResourceUsageSummaryModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformResourceUsageSummary', 'platformResourceUsageSummaries', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformResourceUsageSummaryFilter', 'PlatformResourceUsageSummaryOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'platformResourceUsageSummaries',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformResourceUsageSummary', 'platformResourceUsageSummaries', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformResourceUsageSummaryFilter', 'PlatformResourceUsageSummaryOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'platformResourceUsageSummary',
            document,
            variables,
            transform: (data) => ({
                platformResourceUsageSummary: data.platformResourceUsageSummaries?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformResourceUsageSummary', 'platformResourceUsageSummaries', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformResourceUsageSummaryFilter', 'PlatformResourceUsageSummaryOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'platformResourceUsageSummary',
            document,
            variables,
            transform: (data) => ({
                platformResourceUsageSummary: data.platformResourceUsageSummaries?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformResourceUsageSummary', 'createPlatformResourceUsageSummary', 'platformResourceUsageSummary', args.select, args.data, 'CreatePlatformResourceUsageSummaryInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'createPlatformResourceUsageSummary',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformResourceUsageSummary', 'updatePlatformResourceUsageSummary', 'platformResourceUsageSummary', args.select, args.where.id, args.data, 'UpdatePlatformResourceUsageSummaryInput', 'id', 'platformResourceUsageSummaryPatch', connectionFieldsMap, {
            date: args.where.date,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'updatePlatformResourceUsageSummary',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformResourceUsageSummary', 'deletePlatformResourceUsageSummary', 'platformResourceUsageSummary', {
            id: args.where.id,
            date: args.where.date,
        }, 'DeletePlatformResourceUsageSummaryInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageSummary',
            fieldName: 'deletePlatformResourceUsageSummary',
            document,
            variables,
        });
    }
}
