require "optparse"
require "devops-client/options/common_options"

class ProviderOptions < CommonOptions

  commands :list, :accounts, {:account => [:create, :delete]}, :flavors, :images, :networks, :security_groups, :vpc

  COMMAND_NAME = "provider"

  def initialize args, def_options
    super(args, def_options)
    self.header = I18n.t("headers.provider")
    self.list_params = []
    self.accounts_params = %w(PROVIDER)
    self.account_create_params = %w(PROVIDER ACCOUNT)
    self.account_delete_params = %w(PROVIDER ACCOUNT)
    self.flavors_params = %w(PROVIDER ACCOUNT)
    self.images_params = %w(PROVIDER ACCOUNT)
    self.networks_params = %w(PROVIDER ACCOUNT)
    self.security_groups_params = %w(PROVIDER ACCOUNT [VPC_ID])
    self.vpc_params = %w(PROVIDER ACCOUNT)
  end

  def account_create_options
    self.options do |parser, options|
      parser.banner << self.account_create_banner
      parser.resource_name = "provider.account"

      parser.recognize_option_value(:description)
      parser.recognize_option_value(:ssh_key)
      parser.recognize_option_value(:use_iam_profile, type: :switch, switch_value: true, default: false)
      parser.recognize_option_value(:access_key_id)
      parser.recognize_option_value(:secret_access_key)
    end
  end

end
