import { and } from '../expression/logical-operator';
import { addExpression } from '../expression/param-util';
import { addCondition } from '../expression/request-expression-builder';
import { BaseRequest } from './base.request';
export class WriteRequest extends 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 addCondition('ConditionExpression', attributePath, this, this.metadata);
    }
    /**
     * @param conditionDefFns
     */
    onlyIf(...conditionDefFns) {
        const condition = and(...conditionDefFns)(undefined, this.metadata);
        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;
    }
}
//# sourceMappingURL=write.request.js.map