#compdef xsec_policy_cli

_cyclopts_xsec_policy_cli() {
  local line state

  _arguments -C \
    '--help[Display this message and exit.]' \
    '-h[Display this message and exit.]' \
    '--version[Display application version.]' \
    '1: :->cmds' \
    '*::arg:->args'

  case $state in
    cmds)
      local -a commands
      commands=(
        'resources:'
        'session:'
        'target:'
        'profile:'
        'policy:'
        'events:'
        'completion:shell 补全脚本管理。'
        'check:'
        'list:'
      )
      _describe -t commands 'command' commands
      ;;
    args)
      case $words[1] in
        resources)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'check:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                check)
                  _arguments \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        session)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'params:'
                'create:'
                'list:'
                'status:'
                'pre-check:'
                'backup:'
                'apply:'
                'verify:'
                'commit:'
                'rollback:'
                'monitor:'
                'close:'
                'discard:'
                'events:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                params)
                  _arguments -C \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]' \
                    '1: :->cmds' \
                    '*::arg:->args'

                  case $state in
                    cmds)
                      local -a commands
                      commands=(
                        'show:'
                        'export:'
                        'validate:'
                        'import:'
                      )
                      _describe -t commands 'command' commands
                      ;;
                    args)
                      case $words[1] in
                        show)
                          case ${words[CURRENT]} in
                            --format=*)
                              compset -P '--format='
                              compadd -- 'table' 'toml' 'json'
                              return
                              ;;
                          esac
                          _arguments \
                            '1:SESSION_ID' \
                            '*--policy[--policy]:policy' \
                            "*--format[--format]:format:(table toml json)" \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                        export)
                          _arguments \
                            '1:SESSION_ID' \
                            '*--output[--output]:output' \
                            '*--policy[--policy]:policy' \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                        validate)
                          _arguments \
                            '1:SESSION_ID' \
                            '*--input[--input]:input' \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                        import)
                          _arguments \
                            '1:SESSION_ID' \
                            '*--input[--input]:input' \
                            '--dry-run[--dry-run]' \
                            '--yes[--yes]' \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                      esac
                      ;;
                  esac
                  ;;
                create)
                  _arguments \
                    '*--target[--target]:target' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                list)
                  case ${words[CURRENT]} in
                    --pager=*)
                      compset -P '--pager='
                      compadd -- 'auto' 'always' 'never'
                      return
                      ;;
                  esac
                  _arguments \
                    "*--pager[--pager]:pager:(auto always never)" \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                status)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                pre-check)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                backup)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                apply)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                verify)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                commit)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                rollback)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                monitor)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                close)
                  _arguments \
                    '1:SESSION_ID' \
                    '--no-rollback[--no-rollback]' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                discard)
                  _arguments \
                    '1:SESSION_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                events)
                  case ${words[CURRENT]} in
                    --pager=*)
                      compset -P '--pager='
                      compadd -- 'auto' 'always' 'never'
                      return
                      ;;
                  esac
                  _arguments \
                    '1:SESSION_ID' \
                    "*--pager[--pager]:pager:(auto always never)" \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        target)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'list:'
                'show:'
                'check:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                list)
                  _arguments \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                show)
                  _arguments \
                    '1:RESOURCE_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                check)
                  _arguments \
                    '1:RESOURCE_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        profile)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'list:'
                'show:'
                'check:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                list)
                  _arguments \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                show)
                  _arguments \
                    '1:RESOURCE_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                check)
                  _arguments \
                    '1:RESOURCE_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        policy)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'params:'
                'list:'
                'show:'
                'check:'
                'status:'
                'monitor:'
                'events:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                params)
                  _arguments -C \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]' \
                    '1: :->cmds' \
                    '*::arg:->args'

                  case $state in
                    cmds)
                      local -a commands
                      commands=(
                        'show:'
                        'export:'
                        'validate:'
                        'import:'
                      )
                      _describe -t commands 'command' commands
                      ;;
                    args)
                      case $words[1] in
                        show)
                          case ${words[CURRENT]} in
                            --format=*)
                              compset -P '--format='
                              compadd -- 'table' 'toml' 'json'
                              return
                              ;;
                          esac
                          _arguments \
                            '1:POLICY_ID' \
                            "*--format[--format]:format:(table toml json)" \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                        export)
                          _arguments \
                            '1:POLICY_ID' \
                            '*--output[--output]:output' \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                        validate)
                          _arguments \
                            '1:POLICY_ID' \
                            '*--input[--input]:input' \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                        import)
                          _arguments \
                            '1:POLICY_ID' \
                            '*--input[--input]:input' \
                            '--dry-run[--dry-run]' \
                            '--yes[--yes]' \
                            '--help[Display this message and exit.]' \
                            '-h[Display this message and exit.]' \
                            '--version[Display application version.]'

                          ;;
                      esac
                      ;;
                  esac
                  ;;
                list)
                  _arguments \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                show)
                  _arguments \
                    '1:RESOURCE_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                check)
                  _arguments \
                    '1:RESOURCE_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                status)
                  _arguments \
                    '1:POLICY_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                monitor)
                  _arguments \
                    '1:POLICY_ID' \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
                events)
                  case ${words[CURRENT]} in
                    --pager=*)
                      compset -P '--pager='
                      compadd -- 'auto' 'always' 'never'
                      return
                      ;;
                  esac
                  _arguments \
                    '1:POLICY_ID' \
                    "*--pager[--pager]:pager:(auto always never)" \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        events)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'list:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                list)
                  case ${words[CURRENT]} in
                    --pager=*)
                      compset -P '--pager='
                      compadd -- 'auto' 'always' 'never'
                      return
                      ;;
                  esac
                  _arguments \
                    '*--session-id[--session-id]:session-id' \
                    '*--policy-id[--policy-id]:policy-id' \
                    "*--pager[--pager]:pager:(auto always never)" \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        completion)
          _arguments -C \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]' \
            '1: :->cmds' \
            '*::arg:->args'

          case $state in
            cmds)
              local -a commands
              commands=(
                'install:'
              )
              _describe -t commands 'command' commands
              ;;
            args)
              case $words[1] in
                install)
                  case ${words[CURRENT]} in
                    --shell=*)
                      compset -P '--shell='
                      compadd -- 'bash' 'zsh' 'fish'
                      return
                      ;;
                    --mode=*)
                      compset -P '--mode='
                      compadd -- 'static' 'dynamic'
                      return
                      ;;
                  esac
                  _arguments \
                    "*--shell[--shell]:shell:(bash zsh fish)" \
                    "*--mode[--mode]:mode:(static dynamic)" \
                    '--help[Display this message and exit.]' \
                    '-h[Display this message and exit.]' \
                    '--version[Display application version.]'

                  ;;
              esac
              ;;
          esac
          ;;
        check)
          _arguments \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]'

          ;;
        list)
          _arguments \
            '--help[Display this message and exit.]' \
            '-h[Display this message and exit.]' \
            '--version[Display application version.]'

          ;;
      esac
      ;;
  esac
}

