var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var QueueSASPermissions_exports = {};
__export(QueueSASPermissions_exports, {
  QueueSASPermissions: () => QueueSASPermissions
});
module.exports = __toCommonJS(QueueSASPermissions_exports);
class QueueSASPermissions {
  /**
   * Creates a {@link QueueSASPermissions} from the specified permissions string. This method will throw an
   * Error if it encounters a character that does not correspond to a valid permission.
   *
   * @param permissions -
   */
  static parse(permissions) {
    const queueSASPermissions = new QueueSASPermissions();
    for (const char of permissions) {
      switch (char) {
        case "r":
          queueSASPermissions.read = true;
          break;
        case "a":
          queueSASPermissions.add = true;
          break;
        case "u":
          queueSASPermissions.update = true;
          break;
        case "p":
          queueSASPermissions.process = true;
          break;
        default:
          throw new RangeError(`Invalid permission: ${char}`);
      }
    }
    return queueSASPermissions;
  }
  /**
   * Specifies Read access granted.
   */
  read = false;
  /**
   * Specifies Add access granted.
   */
  add = false;
  /**
   * Specifies Update access granted.
   */
  update = false;
  /**
   * Specifies Process access granted.
   */
  process = false;
  /**
   * Converts the given permissions to a string. Using this method will guarantee the permissions are in an
   * order accepted by the service.
   *
   * @returns A string which represents the QueueSASPermissions
   */
  toString() {
    const permissions = [];
    if (this.read) {
      permissions.push("r");
    }
    if (this.add) {
      permissions.push("a");
    }
    if (this.update) {
      permissions.push("u");
    }
    if (this.process) {
      permissions.push("p");
    }
    return permissions.join("");
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  QueueSASPermissions
});
//# sourceMappingURL=QueueSASPermissions.js.map
