=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 AdminCreateRunner < ApiModelBase
    attr_accessor :region_id

    attr_accessor :name

    attr_accessor :api_key

    # The api version of the runner to create
    attr_accessor :api_version

    # The domain of the runner
    attr_accessor :domain

    # The API URL of the runner
    attr_accessor :api_url

    # The proxy URL of the runner
    attr_accessor :proxy_url

    # The CPU capacity of the runner
    attr_accessor :cpu

    # The memory capacity of the runner in GiB
    attr_accessor :memory_gi_b

    # The disk capacity of the runner in GiB
    attr_accessor :disk_gi_b

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'region_id' => :'regionId',
        :'name' => :'name',
        :'api_key' => :'apiKey',
        :'api_version' => :'apiVersion',
        :'domain' => :'domain',
        :'api_url' => :'apiUrl',
        :'proxy_url' => :'proxyUrl',
        :'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
      {
        :'region_id' => :'String',
        :'name' => :'String',
        :'api_key' => :'String',
        :'api_version' => :'String',
        :'domain' => :'String',
        :'api_url' => :'String',
        :'proxy_url' => :'String',
        :'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::AdminCreateRunner` 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::AdminCreateRunner`. 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?(:'region_id')
        self.region_id = attributes[:'region_id']
      else
        self.region_id = nil
      end

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

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

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

      if attributes.key?(:'domain')
        self.domain = attributes[:'domain']
      end

      if attributes.key?(:'api_url')
        self.api_url = attributes[:'api_url']
      end

      if attributes.key?(:'proxy_url')
        self.proxy_url = attributes[:'proxy_url']
      end

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

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

      if attributes.key?(:'disk_gi_b')
        self.disk_gi_b = attributes[:'disk_gi_b']
      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 @region_id.nil?
        invalid_properties.push('invalid value for "region_id", region_id cannot be nil.')
      end

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

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

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

      pattern = Regexp.new(/^(0|2)$/)
      if @api_version !~ pattern
        invalid_properties.push("invalid value for \"api_version\", must conform to the pattern #{pattern}.")
      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 @region_id.nil?
      return false if @name.nil?
      return false if @api_key.nil?
      return false if @api_version.nil?
      return false if @api_version !~ Regexp.new(/^(0|2)$/)
      true
    end

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

      @region_id = region_id
    end

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

      @name = name
    end

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

      @api_key = api_key
    end

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

      pattern = Regexp.new(/^(0|2)$/)
      if api_version !~ pattern
        fail ArgumentError, "invalid value for \"api_version\", must conform to the pattern #{pattern}."
      end

      @api_version = api_version
    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 &&
          region_id == o.region_id &&
          name == o.name &&
          api_key == o.api_key &&
          api_version == o.api_version &&
          domain == o.domain &&
          api_url == o.api_url &&
          proxy_url == o.proxy_url &&
          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
      [region_id, name, api_key, api_version, domain, api_url, proxy_url, 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
