text: 'use strict';
  
  const { isBetaEnabled } = require("../../base/model");
  
  // Only to be used with validator.js - a correct this value needs to be provided!
  
  function validateDefaultValues(member, memberName, prop, path) {
    // OData allows simple values only (val, -val, enum), no expressions or functions
    // Leave the default value check to the Database.
    // E.g. HANA allows functions on columns but only simple values on parameter definitions
  
    if(member.default && this.csn.options.toOdata && isBetaEnabled(this.csn.options, 'odataDefaultValues')) {
      // unary minus is xpr: [ "-", { val: ... } ]
      if(member.default.xpr) {
        let i = 0;
        // consume all unary signs
        while(member.default.xpr[i] === '-' || member.default.xpr[i] === '+') i++;
        if(i>1)
          this.error(null, path, `Illegal number of unary '+/-' operators`);
      }
    }
  }
  
  function rejectParamDefaultsInHanaCds(member, memberName, prop, path) {
    if(member.default && prop === 'params' && this.csn.options.toHana) {
      this.error(null, path, `Parameter default values are not supported in HANA CDS`);
    }
  }
  
  module.exports = { validateDefaultValues, rejectParamDefaultsInHanaCds };
  