require 'lib/helpers/result_object'

module Devops
  module Executor
    class ServerOperationResult < Helpers::ResultObject

      set_result_codes(
        ok: 0,
        server_bootstrap_fail: 2,
        server_cannot_update_tags: 3,
        server_bootstrap_private_ip_unset: 4,
        server_not_in_chef_nodes: 5,
        server_bootstrap_unknown_error: 7,
        deploy_unknown_error: 6,
        deploy_failed: 8,
        creating_server_unknown_error: 9,
        creating_server_in_cloud_failed: 10,
        server_ssh_error: 11,
        deploy_info_failed: 12
      )

      def one_of_bootstrap_errors?
        [:server_bootstrap_fail, :server_not_in_chef_nodes, :server_bootstrap_unknown_error].include?(reason)
      end

    end

    module ServerOperationResultCode
      def error_code(reason)
        ServerOperationResult.code_of_reason(reason)
      end

=begin
      def result_object(reason)
        ServerOperationResult.
      end
=end
    end

  end
end
