"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const metadata_1 = require("../../decorator/metadata");
const get_table_name_function_1 = require("../get-table-name.function");
/**
 * Base Request for all Request classes usable with DynamoStore.
 * which means they have only one table they work with
 * (even if the actual operation would allow to use multiple tables. e.g. BatchWriteSingleTable)
 */
class BaseRequest {
    constructor(dynamoRx, modelClazz) {
        this.dynamoRx = dynamoRx;
        if (modelClazz === null || modelClazz === undefined) {
            throw new Error(`please provide the ModelConstructor for the request, won't work otherwise`);
        }
        this.modelClazz = modelClazz;
        this.metadata = metadata_1.metadataForClass(this.modelClazz);
        if (!this.metadata.modelOptions) {
            throw new Error('given ModelConstructor has no @Model decorator');
        }
        this.tableName = get_table_name_function_1.getTableName(this.metadata);
        this.params = {};
    }
    returnConsumedCapacity(level) {
        this.params.ReturnConsumedCapacity = level;
        return this;
    }
}
exports.BaseRequest = BaseRequest;
//# sourceMappingURL=base.request.js.map