=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 SshAccessDto < ApiModelBase
    # Unique identifier for the SSH access
    attr_accessor :id

    # ID of the sandbox this SSH access is for
    attr_accessor :sandbox_id

    # SSH access token
    attr_accessor :token

    # When the SSH access expires
    attr_accessor :expires_at

    # When the SSH access was created
    attr_accessor :created_at

    # When the SSH access was last updated
    attr_accessor :updated_at

    # SSH command to connect to the sandbox
    attr_accessor :ssh_command

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'id' => :'id',
        :'sandbox_id' => :'sandboxId',
        :'token' => :'token',
        :'expires_at' => :'expiresAt',
        :'created_at' => :'createdAt',
        :'updated_at' => :'updatedAt',
        :'ssh_command' => :'sshCommand'
      }
    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
      {
        :'id' => :'String',
        :'sandbox_id' => :'String',
        :'token' => :'String',
        :'expires_at' => :'Time',
        :'created_at' => :'Time',
        :'updated_at' => :'Time',
        :'ssh_command' => :'String'
      }
    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::SshAccessDto` 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::SshAccessDto`. 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?(:'id')
        self.id = attributes[:'id']
      else
        self.id = nil
      end

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

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

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

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

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

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

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

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

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

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

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

      if @ssh_command.nil?
        invalid_properties.push('invalid value for "ssh_command", ssh_command 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 @id.nil?
      return false if @sandbox_id.nil?
      return false if @token.nil?
      return false if @expires_at.nil?
      return false if @created_at.nil?
      return false if @updated_at.nil?
      return false if @ssh_command.nil?
      true
    end

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

      @id = id
    end

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

      @sandbox_id = sandbox_id
    end

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

      @token = token
    end

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

      @expires_at = expires_at
    end

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

      @created_at = created_at
    end

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

      @updated_at = updated_at
    end

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

      @ssh_command = ssh_command
    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 &&
          id == o.id &&
          sandbox_id == o.sandbox_id &&
          token == o.token &&
          expires_at == o.expires_at &&
          created_at == o.created_at &&
          updated_at == o.updated_at &&
          ssh_command == o.ssh_command
    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
      [id, sandbox_id, token, expires_at, created_at, updated_at, ssh_command].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
