import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformResourceUsageLogModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformResourceUsageLog', 'platformResourceUsageLogs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformResourceUsageLogFilter', 'PlatformResourceUsageLogOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageLog',
            fieldName: 'platformResourceUsageLogs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformResourceUsageLog', 'platformResourceUsageLogs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformResourceUsageLogFilter', 'PlatformResourceUsageLogOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageLog',
            fieldName: 'platformResourceUsageLog',
            document,
            variables,
            transform: (data) => ({
                platformResourceUsageLog: data.platformResourceUsageLogs?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformResourceUsageLog', 'platformResourceUsageLogs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformResourceUsageLogFilter', 'PlatformResourceUsageLogOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceUsageLog',
            fieldName: 'platformResourceUsageLog',
            document,
            variables,
            transform: (data) => ({
                platformResourceUsageLog: data.platformResourceUsageLogs?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformResourceUsageLog', 'createPlatformResourceUsageLog', 'platformResourceUsageLog', args.select, args.data, 'CreatePlatformResourceUsageLogInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageLog',
            fieldName: 'createPlatformResourceUsageLog',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformResourceUsageLog', 'updatePlatformResourceUsageLog', 'platformResourceUsageLog', args.select, args.where.id, args.data, 'UpdatePlatformResourceUsageLogInput', 'id', 'platformResourceUsageLogPatch', connectionFieldsMap, {
            sampledAt: args.where.sampledAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageLog',
            fieldName: 'updatePlatformResourceUsageLog',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformResourceUsageLog', 'deletePlatformResourceUsageLog', 'platformResourceUsageLog', {
            id: args.where.id,
            sampledAt: args.where.sampledAt,
        }, 'DeletePlatformResourceUsageLogInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceUsageLog',
            fieldName: 'deletePlatformResourceUsageLog',
            document,
            variables,
        });
    }
}
