=begin
#Daytona Toolbox API

#Daytona Toolbox API

The version of the OpenAPI document: v0.0.0-dev

Generated by: https://openapi-generator.tech
Generator version: 7.21.0

=end

require 'date'
require 'time'

module DaytonaToolboxApiClient
  class Recording < ApiModelBase
    attr_accessor :duration_seconds

    attr_accessor :end_time

    attr_accessor :file_name

    attr_accessor :file_path

    attr_accessor :id

    attr_accessor :size_bytes

    attr_accessor :start_time

    attr_accessor :status

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'duration_seconds' => :'durationSeconds',
        :'end_time' => :'endTime',
        :'file_name' => :'fileName',
        :'file_path' => :'filePath',
        :'id' => :'id',
        :'size_bytes' => :'sizeBytes',
        :'start_time' => :'startTime',
        :'status' => :'status'
      }
    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
      {
        :'duration_seconds' => :'Float',
        :'end_time' => :'String',
        :'file_name' => :'String',
        :'file_path' => :'String',
        :'id' => :'String',
        :'size_bytes' => :'Integer',
        :'start_time' => :'String',
        :'status' => :'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 `DaytonaToolboxApiClient::Recording` 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 `DaytonaToolboxApiClient::Recording`. 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?(:'duration_seconds')
        self.duration_seconds = attributes[:'duration_seconds']
      end

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

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

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

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

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

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

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

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

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

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

      if @status.nil?
        invalid_properties.push('invalid value for "status", status 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 @file_name.nil?
      return false if @file_path.nil?
      return false if @id.nil?
      return false if @start_time.nil?
      return false if @status.nil?
      true
    end

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

      @file_name = file_name
    end

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

      @file_path = file_path
    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] start_time Value to be assigned
    def start_time=(start_time)
      if start_time.nil?
        fail ArgumentError, 'start_time cannot be nil'
      end

      @start_time = start_time
    end

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

      @status = status
    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 &&
          duration_seconds == o.duration_seconds &&
          end_time == o.end_time &&
          file_name == o.file_name &&
          file_path == o.file_path &&
          id == o.id &&
          size_bytes == o.size_bytes &&
          start_time == o.start_time &&
          status == o.status
    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
      [duration_seconds, end_time, file_name, file_path, id, size_bytes, start_time, status].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
