=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 FileInfo < ApiModelBase
    attr_accessor :name

    attr_accessor :is_dir

    attr_accessor :size

    attr_accessor :mod_time

    attr_accessor :mode

    attr_accessor :permissions

    attr_accessor :owner

    attr_accessor :group

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'name' => :'name',
        :'is_dir' => :'isDir',
        :'size' => :'size',
        :'mod_time' => :'modTime',
        :'mode' => :'mode',
        :'permissions' => :'permissions',
        :'owner' => :'owner',
        :'group' => :'group'
      }
    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
      {
        :'name' => :'String',
        :'is_dir' => :'Boolean',
        :'size' => :'Float',
        :'mod_time' => :'String',
        :'mode' => :'String',
        :'permissions' => :'String',
        :'owner' => :'String',
        :'group' => :'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::FileInfo` 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::FileInfo`. 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?(:'name')
        self.name = attributes[:'name']
      else
        self.name = nil
      end

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

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

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

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

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

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

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

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

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

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

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

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

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

      if @group.nil?
        invalid_properties.push('invalid value for "group", group 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 @name.nil?
      return false if @is_dir.nil?
      return false if @size.nil?
      return false if @mod_time.nil?
      return false if @mode.nil?
      return false if @permissions.nil?
      return false if @owner.nil?
      return false if @group.nil?
      true
    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] is_dir Value to be assigned
    def is_dir=(is_dir)
      if is_dir.nil?
        fail ArgumentError, 'is_dir cannot be nil'
      end

      @is_dir = is_dir
    end

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

      @size = size
    end

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

      @mod_time = mod_time
    end

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

      @mode = mode
    end

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

      @permissions = permissions
    end

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

      @owner = owner
    end

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

      @group = group
    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 &&
          name == o.name &&
          is_dir == o.is_dir &&
          size == o.size &&
          mod_time == o.mod_time &&
          mode == o.mode &&
          permissions == o.permissions &&
          owner == o.owner &&
          group == o.group
    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
      [name, is_dir, size, mod_time, mode, permissions, owner, group].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
