module Vcloud
  module Item
    class Vdc < SimpleType

      attr_accessor :id, :type, :name, :href, :description
      attr_accessor :status
      attr_accessor :allocation_model

      attr_accessor :compute_capacity_cpu_units
      attr_accessor :compute_capacity_cpu_allocated
      attr_accessor :compute_capacity_cpu_limit
      attr_accessor :compute_capacity_cpu_reserved
      attr_accessor :compute_capacity_cpu_used
      attr_accessor :compute_capacity_cpu_overhead

      attr_accessor :compute_capacity_memory_units
      attr_accessor :compute_capacity_memory_allocated
      attr_accessor :compute_capacity_memory_limit
      attr_accessor :compute_capacity_memory_reserved
      attr_accessor :compute_capacity_memory_used
      attr_accessor :compute_capacity_memory_overhead

      attr_accessor :vapps
      attr_accessor :vapp_templates
      attr_accessor :medias
      attr_accessor :available_networks
      attr_accessor :capabilities_supported_hardware_versions 

      attr_accessor :nic_quota
      attr_accessor :network_quota
      attr_accessor :used_network_count
      attr_accessor :vm_quota
      attr_accessor :is_enabled

      attr_accessor :vdc_storage_profiles

      def initialize
        @vapps = []
        @vapp_templates = []
        @medias = []
        @available_networks = []
        @capabilities_supported_hardware_versions = []
        @vdc_storage_profiles = []
      end

      def vapp(vapp_name)
        return nil if vapp_name.nil?

        vapps.find do |vapp|
          vapp.name.downcase == vapp_name.downcase
        end
      end

      def to_s
        "vdc #{@name}, #{@description}, #{@status}"
      end
    end
  end
end

