#!/bin/bash
# info: get web domain value
# options: USER DOMAIN KEY
#
# The function is intended for obtaining a domain value by the key. This call
# is useful for arranging composite queries. The answer is displayed only in
# raw form; output formats aren't supported.


#----------------------------------------------------------#
#                    Variable&Function                     #
#----------------------------------------------------------#

# Say goodbye
echo "This script is not used anymore"
exit

# Argument definition
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
key=$(echo "$3"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")

# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/conf/vesta.conf


#----------------------------------------------------------#
#                    Verifications                         #
#----------------------------------------------------------#

check_args '3' "$#" 'USER DOMAIN KEY'
is_format_valid 'user' 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"


#----------------------------------------------------------#
#                       Action                             #
#----------------------------------------------------------#

get_domain_values 'web'
eval echo $key


#----------------------------------------------------------#
#                       Vesta                              #
#----------------------------------------------------------#

exit