=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 DaytonaConfiguration < ApiModelBase
    # Daytona version
    attr_accessor :version

    # PostHog configuration
    attr_accessor :posthog

    # OIDC configuration
    attr_accessor :oidc

    # Whether linked accounts are enabled
    attr_accessor :linked_accounts_enabled

    # System announcements
    attr_accessor :announcements

    # Pylon application ID
    attr_accessor :pylon_app_id

    # Proxy template URL
    attr_accessor :proxy_template_url

    # Toolbox template URL
    attr_accessor :proxy_toolbox_url

    # Default snapshot for sandboxes
    attr_accessor :default_snapshot

    # Dashboard URL
    attr_accessor :dashboard_url

    # Maximum auto-archive interval in minutes
    attr_accessor :max_auto_archive_interval

    # Whether maintenance mode is enabled
    attr_accessor :maintanance_mode

    # Current environment
    attr_accessor :environment

    # Billing API URL
    attr_accessor :billing_api_url

    # Analytics API URL
    attr_accessor :analytics_api_url

    # SSH Gateway command
    attr_accessor :ssh_gateway_command

    # Base64 encoded SSH Gateway public key
    attr_accessor :ssh_gateway_public_key

    # Rate limit configuration
    attr_accessor :rate_limit

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'version' => :'version',
        :'posthog' => :'posthog',
        :'oidc' => :'oidc',
        :'linked_accounts_enabled' => :'linkedAccountsEnabled',
        :'announcements' => :'announcements',
        :'pylon_app_id' => :'pylonAppId',
        :'proxy_template_url' => :'proxyTemplateUrl',
        :'proxy_toolbox_url' => :'proxyToolboxUrl',
        :'default_snapshot' => :'defaultSnapshot',
        :'dashboard_url' => :'dashboardUrl',
        :'max_auto_archive_interval' => :'maxAutoArchiveInterval',
        :'maintanance_mode' => :'maintananceMode',
        :'environment' => :'environment',
        :'billing_api_url' => :'billingApiUrl',
        :'analytics_api_url' => :'analyticsApiUrl',
        :'ssh_gateway_command' => :'sshGatewayCommand',
        :'ssh_gateway_public_key' => :'sshGatewayPublicKey',
        :'rate_limit' => :'rateLimit'
      }
    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
      {
        :'version' => :'String',
        :'posthog' => :'PosthogConfig',
        :'oidc' => :'OidcConfig',
        :'linked_accounts_enabled' => :'Boolean',
        :'announcements' => :'Hash<String, Announcement>',
        :'pylon_app_id' => :'String',
        :'proxy_template_url' => :'String',
        :'proxy_toolbox_url' => :'String',
        :'default_snapshot' => :'String',
        :'dashboard_url' => :'String',
        :'max_auto_archive_interval' => :'Float',
        :'maintanance_mode' => :'Boolean',
        :'environment' => :'String',
        :'billing_api_url' => :'String',
        :'analytics_api_url' => :'String',
        :'ssh_gateway_command' => :'String',
        :'ssh_gateway_public_key' => :'String',
        :'rate_limit' => :'RateLimitConfig'
      }
    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::DaytonaConfiguration` 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::DaytonaConfiguration`. 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?(:'version')
        self.version = attributes[:'version']
      else
        self.version = nil
      end

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

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

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

      if attributes.key?(:'announcements')
        if (value = attributes[:'announcements']).is_a?(Hash)
          self.announcements = value
        end
      else
        self.announcements = nil
      end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if @environment.nil?
        invalid_properties.push('invalid value for "environment", environment 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 @version.nil?
      return false if @oidc.nil?
      return false if @linked_accounts_enabled.nil?
      return false if @announcements.nil?
      return false if @proxy_template_url.nil?
      return false if @proxy_toolbox_url.nil?
      return false if @default_snapshot.nil?
      return false if @dashboard_url.nil?
      return false if @max_auto_archive_interval.nil?
      return false if @maintanance_mode.nil?
      return false if @environment.nil?
      true
    end

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

      @version = version
    end

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

      @oidc = oidc
    end

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

      @linked_accounts_enabled = linked_accounts_enabled
    end

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

      @announcements = announcements
    end

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

      @proxy_template_url = proxy_template_url
    end

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

      @proxy_toolbox_url = proxy_toolbox_url
    end

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

      @default_snapshot = default_snapshot
    end

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

      @dashboard_url = dashboard_url
    end

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

      @max_auto_archive_interval = max_auto_archive_interval
    end

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

      @maintanance_mode = maintanance_mode
    end

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

      @environment = environment
    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 &&
          version == o.version &&
          posthog == o.posthog &&
          oidc == o.oidc &&
          linked_accounts_enabled == o.linked_accounts_enabled &&
          announcements == o.announcements &&
          pylon_app_id == o.pylon_app_id &&
          proxy_template_url == o.proxy_template_url &&
          proxy_toolbox_url == o.proxy_toolbox_url &&
          default_snapshot == o.default_snapshot &&
          dashboard_url == o.dashboard_url &&
          max_auto_archive_interval == o.max_auto_archive_interval &&
          maintanance_mode == o.maintanance_mode &&
          environment == o.environment &&
          billing_api_url == o.billing_api_url &&
          analytics_api_url == o.analytics_api_url &&
          ssh_gateway_command == o.ssh_gateway_command &&
          ssh_gateway_public_key == o.ssh_gateway_public_key &&
          rate_limit == o.rate_limit
    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
      [version, posthog, oidc, linked_accounts_enabled, announcements, pylon_app_id, proxy_template_url, proxy_toolbox_url, default_snapshot, dashboard_url, max_auto_archive_interval, maintanance_mode, environment, billing_api_url, analytics_api_url, ssh_gateway_command, ssh_gateway_public_key, rate_limit].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
