#!/bin/bash

# shellcheck source=../scripts/helpers/index.sh
source /usr/local/bin/helpers/index.sh

function _main() {
  _require_n_parameters_or_print_usage 1 "${@}"

  local MAIL_ACCOUNT="${1}"

  _validate_parameters
  _manage_dovecot_quota_delete "${MAIL_ACCOUNT}"
}

function __usage() {
  printf '%s' "${PURPLE}delquota${RED}(${YELLOW}8${RED})

${ORANGE}USAGE${RESET}
    ./setup.sh quota del <MAIL ACCOUNT>

${ORANGE}OPTIONS${RESET}
    ${BLUE}Generic Program Information${RESET}
        help       Print the usage information.

${ORANGE}DESCRIPTION${RESET}
    Remove any quota set for an existing mail account.

${ORANGE}EXAMPLES${RESET}
    ${LWHITE}./setup.sh quota del user@example.com${RESET}

${ORANGE}EXIT STATUS${RESET}
    Exit status is 0 if command was successful. If wrong arguments are provided
    or arguments contain errors, the script will exit early with exit status 1.

"
}

function _validate_parameters() {
  _arg_expect_mail_account
  _account_should_already_exist
}

_main "${@}"
