import * as tslib_1 from "tslib";
import { isEmpty, isString } from 'lodash';
var ParamUtil = /** @class */ (function () {
    function ParamUtil() {
    }
    ParamUtil.addUpdateExpression = function (updateExpression, params) {
        ParamUtil.addExpression('UpdateExpression', updateExpression, params);
    };
    ParamUtil.addExpression = function (expressionType, condition, params) {
        var expressionAttributeNames = tslib_1.__assign({}, condition.attributeNames, params.ExpressionAttributeNames);
        var expressionAttributeValues = tslib_1.__assign({}, condition.attributeValues, params.ExpressionAttributeValues);
        if (!isEmpty(expressionAttributeNames)) {
            params.ExpressionAttributeNames = expressionAttributeNames;
        }
        if (!isEmpty(expressionAttributeValues)) {
            params.ExpressionAttributeValues = expressionAttributeValues;
        }
        var expression = Reflect.get(params, expressionType);
        if (isString(expression)) {
            switch (expressionType) {
                case 'UpdateExpression':
                    if (expression !== '') {
                        throw new Error('params.UpdateExpression is not empty, please use the UpdateRequest.operations() method to define all the update operations');
                    }
                    break;
                default:
                    ;
                    params[expressionType] = expression + " AND " + condition.statement;
            }
        }
        else {
            ;
            params[expressionType] = condition.statement;
        }
    };
    return ParamUtil;
}());
export { ParamUtil };
//# sourceMappingURL=param-util.js.map