import { map } from 'rxjs/operators';
import { and } from '../expression/logical-operator';
import { addExpression } from '../expression/param-util';
import { addCondition } from '../expression/request-expression-builder';
import { StandardRequest } from './standard.request';
export class WriteRequest extends StandardRequest {
    constructor(dynamoRx, modelClazz) {
        super(dynamoRx, modelClazz);
    }
    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;
    }
    exec() {
        return this.execFullResponse().pipe(map(response => {
            return;
        }));
    }
}
//# sourceMappingURL=write.request.js.map