"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const logical_operator_1 = require("../expression/logical-operator");
const param_util_1 = require("../expression/param-util");
const request_expression_builder_1 = require("../expression/request-expression-builder");
const base_request_1 = require("./base.request");
class WriteRequest extends base_request_1.BaseRequest {
    constructor(dynamoRx, modelClazz, tableName) {
        super(dynamoRx, modelClazz, tableName);
    }
    returnConsumedCapacity(level) {
        this.params.ReturnConsumedCapacity = level;
        return this;
    }
    returnItemCollectionMetrics(returnItemCollectionMetrics) {
        this.params.ReturnItemCollectionMetrics = returnItemCollectionMetrics;
        return this;
    }
    onlyIfAttribute(attributePath) {
        return request_expression_builder_1.addCondition('ConditionExpression', attributePath, this, this.metadata);
    }
    /**
     * @param conditionDefFns
     */
    onlyIf(...conditionDefFns) {
        const condition = logical_operator_1.and(...conditionDefFns)(undefined, this.metadata);
        param_util_1.addExpression('ConditionExpression', condition, this.params);
        return this;
    }
    /*
     * The ReturnValues parameter is used by several DynamoDB operations; however,
     * DeleteItem/PutItem/UpdateItem does not recognize any values other than NONE or ALL_OLD.
     */
    returnValues(returnValues) {
        this.params.ReturnValues = returnValues;
        return this;
    }
}
exports.WriteRequest = WriteRequest;
//# sourceMappingURL=write.request.js.map