=begin
#Daytona

#Daytona AI platform API Docs

The version of the OpenAPI document: 1.0
Contact: support@daytona.com
Generated by: https://openapi-generator.tech
Generator version: 7.21.0

=end

require 'date'
require 'time'

module DaytonaApiClient
  class RunnerHealthMetrics < ApiModelBase
    # Current CPU load average
    attr_accessor :current_cpu_load_average

    # Current CPU usage percentage
    attr_accessor :current_cpu_usage_percentage

    # Current memory usage percentage
    attr_accessor :current_memory_usage_percentage

    # Current disk usage percentage
    attr_accessor :current_disk_usage_percentage

    # Currently allocated CPU cores
    attr_accessor :current_allocated_cpu

    # Currently allocated memory in GiB
    attr_accessor :current_allocated_memory_gi_b

    # Currently allocated disk in GiB
    attr_accessor :current_allocated_disk_gi_b

    # Number of snapshots currently stored
    attr_accessor :current_snapshot_count

    # Number of started sandboxes
    attr_accessor :current_started_sandboxes

    # Total CPU cores on the runner
    attr_accessor :cpu

    # Total RAM in GiB on the runner
    attr_accessor :memory_gi_b

    # Total disk space in GiB on the runner
    attr_accessor :disk_gi_b

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'current_cpu_load_average' => :'currentCpuLoadAverage',
        :'current_cpu_usage_percentage' => :'currentCpuUsagePercentage',
        :'current_memory_usage_percentage' => :'currentMemoryUsagePercentage',
        :'current_disk_usage_percentage' => :'currentDiskUsagePercentage',
        :'current_allocated_cpu' => :'currentAllocatedCpu',
        :'current_allocated_memory_gi_b' => :'currentAllocatedMemoryGiB',
        :'current_allocated_disk_gi_b' => :'currentAllocatedDiskGiB',
        :'current_snapshot_count' => :'currentSnapshotCount',
        :'current_started_sandboxes' => :'currentStartedSandboxes',
        :'cpu' => :'cpu',
        :'memory_gi_b' => :'memoryGiB',
        :'disk_gi_b' => :'diskGiB'
      }
    end

    # Returns attribute mapping this model knows about
    def self.acceptable_attribute_map
      attribute_map
    end

    # Returns all the JSON keys this model knows about
    def self.acceptable_attributes
      acceptable_attribute_map.values
    end

    # Attribute type mapping.
    def self.openapi_types
      {
        :'current_cpu_load_average' => :'Float',
        :'current_cpu_usage_percentage' => :'Float',
        :'current_memory_usage_percentage' => :'Float',
        :'current_disk_usage_percentage' => :'Float',
        :'current_allocated_cpu' => :'Float',
        :'current_allocated_memory_gi_b' => :'Float',
        :'current_allocated_disk_gi_b' => :'Float',
        :'current_snapshot_count' => :'Float',
        :'current_started_sandboxes' => :'Float',
        :'cpu' => :'Float',
        :'memory_gi_b' => :'Float',
        :'disk_gi_b' => :'Float'
      }
    end

    # List of attributes with nullable: true
    def self.openapi_nullable
      Set.new([
      ])
    end

    # Initializes the object
    # @param [Hash] attributes Model attributes in the form of hash
    def initialize(attributes = {})
      if (!attributes.is_a?(Hash))
        fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::RunnerHealthMetrics` initialize method"
      end

      # check to see if the attribute exists and convert string to symbol for hash key
      acceptable_attribute_map = self.class.acceptable_attribute_map
      attributes = attributes.each_with_object({}) { |(k, v), h|
        if (!acceptable_attribute_map.key?(k.to_sym))
          fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::RunnerHealthMetrics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
        end
        h[k.to_sym] = v
      }

      if attributes.key?(:'current_cpu_load_average')
        self.current_cpu_load_average = attributes[:'current_cpu_load_average']
      else
        self.current_cpu_load_average = nil
      end

      if attributes.key?(:'current_cpu_usage_percentage')
        self.current_cpu_usage_percentage = attributes[:'current_cpu_usage_percentage']
      else
        self.current_cpu_usage_percentage = nil
      end

      if attributes.key?(:'current_memory_usage_percentage')
        self.current_memory_usage_percentage = attributes[:'current_memory_usage_percentage']
      else
        self.current_memory_usage_percentage = nil
      end

      if attributes.key?(:'current_disk_usage_percentage')
        self.current_disk_usage_percentage = attributes[:'current_disk_usage_percentage']
      else
        self.current_disk_usage_percentage = nil
      end

      if attributes.key?(:'current_allocated_cpu')
        self.current_allocated_cpu = attributes[:'current_allocated_cpu']
      else
        self.current_allocated_cpu = nil
      end

      if attributes.key?(:'current_allocated_memory_gi_b')
        self.current_allocated_memory_gi_b = attributes[:'current_allocated_memory_gi_b']
      else
        self.current_allocated_memory_gi_b = nil
      end

      if attributes.key?(:'current_allocated_disk_gi_b')
        self.current_allocated_disk_gi_b = attributes[:'current_allocated_disk_gi_b']
      else
        self.current_allocated_disk_gi_b = nil
      end

      if attributes.key?(:'current_snapshot_count')
        self.current_snapshot_count = attributes[:'current_snapshot_count']
      else
        self.current_snapshot_count = nil
      end

      if attributes.key?(:'current_started_sandboxes')
        self.current_started_sandboxes = attributes[:'current_started_sandboxes']
      else
        self.current_started_sandboxes = nil
      end

      if attributes.key?(:'cpu')
        self.cpu = attributes[:'cpu']
      else
        self.cpu = nil
      end

      if attributes.key?(:'memory_gi_b')
        self.memory_gi_b = attributes[:'memory_gi_b']
      else
        self.memory_gi_b = nil
      end

      if attributes.key?(:'disk_gi_b')
        self.disk_gi_b = attributes[:'disk_gi_b']
      else
        self.disk_gi_b = nil
      end
    end

    # Show invalid properties with the reasons. Usually used together with valid?
    # @return Array for valid properties with the reasons
    def list_invalid_properties
      warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
      invalid_properties = Array.new
      if @current_cpu_load_average.nil?
        invalid_properties.push('invalid value for "current_cpu_load_average", current_cpu_load_average cannot be nil.')
      end

      if @current_cpu_usage_percentage.nil?
        invalid_properties.push('invalid value for "current_cpu_usage_percentage", current_cpu_usage_percentage cannot be nil.')
      end

      if @current_memory_usage_percentage.nil?
        invalid_properties.push('invalid value for "current_memory_usage_percentage", current_memory_usage_percentage cannot be nil.')
      end

      if @current_disk_usage_percentage.nil?
        invalid_properties.push('invalid value for "current_disk_usage_percentage", current_disk_usage_percentage cannot be nil.')
      end

      if @current_allocated_cpu.nil?
        invalid_properties.push('invalid value for "current_allocated_cpu", current_allocated_cpu cannot be nil.')
      end

      if @current_allocated_memory_gi_b.nil?
        invalid_properties.push('invalid value for "current_allocated_memory_gi_b", current_allocated_memory_gi_b cannot be nil.')
      end

      if @current_allocated_disk_gi_b.nil?
        invalid_properties.push('invalid value for "current_allocated_disk_gi_b", current_allocated_disk_gi_b cannot be nil.')
      end

      if @current_snapshot_count.nil?
        invalid_properties.push('invalid value for "current_snapshot_count", current_snapshot_count cannot be nil.')
      end

      if @current_started_sandboxes.nil?
        invalid_properties.push('invalid value for "current_started_sandboxes", current_started_sandboxes cannot be nil.')
      end

      if @cpu.nil?
        invalid_properties.push('invalid value for "cpu", cpu cannot be nil.')
      end

      if @memory_gi_b.nil?
        invalid_properties.push('invalid value for "memory_gi_b", memory_gi_b cannot be nil.')
      end

      if @disk_gi_b.nil?
        invalid_properties.push('invalid value for "disk_gi_b", disk_gi_b cannot be nil.')
      end

      invalid_properties
    end

    # Check to see if the all the properties in the model are valid
    # @return true if the model is valid
    def valid?
      warn '[DEPRECATED] the `valid?` method is obsolete'
      return false if @current_cpu_load_average.nil?
      return false if @current_cpu_usage_percentage.nil?
      return false if @current_memory_usage_percentage.nil?
      return false if @current_disk_usage_percentage.nil?
      return false if @current_allocated_cpu.nil?
      return false if @current_allocated_memory_gi_b.nil?
      return false if @current_allocated_disk_gi_b.nil?
      return false if @current_snapshot_count.nil?
      return false if @current_started_sandboxes.nil?
      return false if @cpu.nil?
      return false if @memory_gi_b.nil?
      return false if @disk_gi_b.nil?
      true
    end

    # Custom attribute writer method with validation
    # @param [Object] current_cpu_load_average Value to be assigned
    def current_cpu_load_average=(current_cpu_load_average)
      if current_cpu_load_average.nil?
        fail ArgumentError, 'current_cpu_load_average cannot be nil'
      end

      @current_cpu_load_average = current_cpu_load_average
    end

    # Custom attribute writer method with validation
    # @param [Object] current_cpu_usage_percentage Value to be assigned
    def current_cpu_usage_percentage=(current_cpu_usage_percentage)
      if current_cpu_usage_percentage.nil?
        fail ArgumentError, 'current_cpu_usage_percentage cannot be nil'
      end

      @current_cpu_usage_percentage = current_cpu_usage_percentage
    end

    # Custom attribute writer method with validation
    # @param [Object] current_memory_usage_percentage Value to be assigned
    def current_memory_usage_percentage=(current_memory_usage_percentage)
      if current_memory_usage_percentage.nil?
        fail ArgumentError, 'current_memory_usage_percentage cannot be nil'
      end

      @current_memory_usage_percentage = current_memory_usage_percentage
    end

    # Custom attribute writer method with validation
    # @param [Object] current_disk_usage_percentage Value to be assigned
    def current_disk_usage_percentage=(current_disk_usage_percentage)
      if current_disk_usage_percentage.nil?
        fail ArgumentError, 'current_disk_usage_percentage cannot be nil'
      end

      @current_disk_usage_percentage = current_disk_usage_percentage
    end

    # Custom attribute writer method with validation
    # @param [Object] current_allocated_cpu Value to be assigned
    def current_allocated_cpu=(current_allocated_cpu)
      if current_allocated_cpu.nil?
        fail ArgumentError, 'current_allocated_cpu cannot be nil'
      end

      @current_allocated_cpu = current_allocated_cpu
    end

    # Custom attribute writer method with validation
    # @param [Object] current_allocated_memory_gi_b Value to be assigned
    def current_allocated_memory_gi_b=(current_allocated_memory_gi_b)
      if current_allocated_memory_gi_b.nil?
        fail ArgumentError, 'current_allocated_memory_gi_b cannot be nil'
      end

      @current_allocated_memory_gi_b = current_allocated_memory_gi_b
    end

    # Custom attribute writer method with validation
    # @param [Object] current_allocated_disk_gi_b Value to be assigned
    def current_allocated_disk_gi_b=(current_allocated_disk_gi_b)
      if current_allocated_disk_gi_b.nil?
        fail ArgumentError, 'current_allocated_disk_gi_b cannot be nil'
      end

      @current_allocated_disk_gi_b = current_allocated_disk_gi_b
    end

    # Custom attribute writer method with validation
    # @param [Object] current_snapshot_count Value to be assigned
    def current_snapshot_count=(current_snapshot_count)
      if current_snapshot_count.nil?
        fail ArgumentError, 'current_snapshot_count cannot be nil'
      end

      @current_snapshot_count = current_snapshot_count
    end

    # Custom attribute writer method with validation
    # @param [Object] current_started_sandboxes Value to be assigned
    def current_started_sandboxes=(current_started_sandboxes)
      if current_started_sandboxes.nil?
        fail ArgumentError, 'current_started_sandboxes cannot be nil'
      end

      @current_started_sandboxes = current_started_sandboxes
    end

    # Custom attribute writer method with validation
    # @param [Object] cpu Value to be assigned
    def cpu=(cpu)
      if cpu.nil?
        fail ArgumentError, 'cpu cannot be nil'
      end

      @cpu = cpu
    end

    # Custom attribute writer method with validation
    # @param [Object] memory_gi_b Value to be assigned
    def memory_gi_b=(memory_gi_b)
      if memory_gi_b.nil?
        fail ArgumentError, 'memory_gi_b cannot be nil'
      end

      @memory_gi_b = memory_gi_b
    end

    # Custom attribute writer method with validation
    # @param [Object] disk_gi_b Value to be assigned
    def disk_gi_b=(disk_gi_b)
      if disk_gi_b.nil?
        fail ArgumentError, 'disk_gi_b cannot be nil'
      end

      @disk_gi_b = disk_gi_b
    end

    # Checks equality by comparing each attribute.
    # @param [Object] Object to be compared
    def ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          current_cpu_load_average == o.current_cpu_load_average &&
          current_cpu_usage_percentage == o.current_cpu_usage_percentage &&
          current_memory_usage_percentage == o.current_memory_usage_percentage &&
          current_disk_usage_percentage == o.current_disk_usage_percentage &&
          current_allocated_cpu == o.current_allocated_cpu &&
          current_allocated_memory_gi_b == o.current_allocated_memory_gi_b &&
          current_allocated_disk_gi_b == o.current_allocated_disk_gi_b &&
          current_snapshot_count == o.current_snapshot_count &&
          current_started_sandboxes == o.current_started_sandboxes &&
          cpu == o.cpu &&
          memory_gi_b == o.memory_gi_b &&
          disk_gi_b == o.disk_gi_b
    end

    # @see the `==` method
    # @param [Object] Object to be compared
    def eql?(o)
      self == o
    end

    # Calculates hash code according to all attributes.
    # @return [Integer] Hash code
    def hash
      [current_cpu_load_average, current_cpu_usage_percentage, current_memory_usage_percentage, current_disk_usage_percentage, current_allocated_cpu, current_allocated_memory_gi_b, current_allocated_disk_gi_b, current_snapshot_count, current_started_sandboxes, cpu, memory_gi_b, disk_gi_b].hash
    end

    # Builds the object from hash
    # @param [Hash] attributes Model attributes in the form of hash
    # @return [Object] Returns the model itself
    def self.build_from_hash(attributes)
      return nil unless attributes.is_a?(Hash)
      attributes = attributes.transform_keys(&:to_sym)
      transformed_hash = {}
      openapi_types.each_pair do |key, type|
        if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
          transformed_hash["#{key}"] = nil
        elsif type =~ /\AArray<(.*)>/i
          # check to ensure the input is an array given that the attribute
          # is documented as an array but the input is not
          if attributes[attribute_map[key]].is_a?(Array)
            transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
          end
        elsif !attributes[attribute_map[key]].nil?
          transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
        end
      end
      new(transformed_hash)
    end

    # Returns the object in the form of hash
    # @return [Hash] Returns the object in the form of hash
    def to_hash
      hash = {}
      self.class.attribute_map.each_pair do |attr, param|
        value = self.send(attr)
        if value.nil?
          is_nullable = self.class.openapi_nullable.include?(attr)
          next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
        end

        hash[param] = _to_hash(value)
      end
      hash
    end

  end

end
