#compdef profiles

(( $+functions[_profiles_commands] )) ||
_profiles_commands() {
  local -a commands
  commands=(
    'help:show help'
    'status:indicates if profiles are installed'
    'list:list profile information'
    'show:show expanded profile information'
    'remove:remove profile'
    'sync:synchronize installed configuration profiles with known users'
    'renew:renew configuration profile installed certificate'
    'validate:validation of provisioning profile or DEP server enrollment information'
    'version:display tool version number'
  )
  _describe 'commands' commands
}

_profiles() {
  # local context state line curcontext="$curcontext"
  local context curcontext="$curcontext" state line
  typeset -A opt_args
  local ret=1

  # '(-h)-h[help for profiles]' \
  # '(--help)--help[help for profiles]' \
  # '(-v)--version[Show version information]' \
  # '(--version)-v[Show version information]' \
_arguments -C \
  '1:: :_profiles_commands' \
  '*:: :->command_args' && ret=0

# local rules

# case "$state" in
#   (command_args)
    _arguments \
      '-type[type of profile; either: configuration,provisioning,enrollment,bootstraptoken]:string:' \
      '-user[short user name]:string' \
      '-password[password]:string' \
      '-identifier[profile identifier]:string:' \
      '-path[file path]:string:' \
      '-uuid[profile UUID]:string:' \
      '-enrolledUser[enrolled user name]:string:' \
      '-verbose[enable verbose mode]' \
      '-forced[when removing profiles, automatically confirms requests]' \
      '-all[select all profiles]' \
      '-quiet[enable quiet mode]' \
#     && ret=0
#     ;;
# esac
#
# return ret
}

profiles "$@"
