# pagarme_core_api
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).

module PagarmeCoreApi
  # Request for updating a plan
  class UpdatePlanRequest < BaseModel
    # Plan's name
    # @return [String]
    attr_accessor :name

    # Description
    # @return [String]
    attr_accessor :description

    # Number os installments
    # @return [List of Integer]
    attr_accessor :installments

    # Text that will be shown on the credit card's statement
    # @return [String]
    attr_accessor :statement_descriptor

    # Currency
    # @return [String]
    attr_accessor :currency

    # Interval
    # @return [String]
    attr_accessor :interval

    # Interval count
    # @return [Integer]
    attr_accessor :interval_count

    # Payment methods accepted by the plan
    # @return [List of String]
    attr_accessor :payment_methods

    # Billing type
    # @return [String]
    attr_accessor :billing_type

    # Plan status
    # @return [String]
    attr_accessor :status

    # Indicates if the plan is shippable
    # @return [Boolean]
    attr_accessor :shippable

    # Billing days accepted by the plan
    # @return [List of Integer]
    attr_accessor :billing_days

    # Metadata
    # @return [Array<String, String>]
    attr_accessor :metadata

    # Minimum price
    # @return [Integer]
    attr_accessor :minimum_price

    # Number of trial period in days, where the customer will not be charged
    # @return [Integer]
    attr_accessor :trial_period_days

    # A mapping from model property names to API property names.
    def self.names
      @_hash = {} if @_hash.nil?
      @_hash['name'] = 'name'
      @_hash['description'] = 'description'
      @_hash['installments'] = 'installments'
      @_hash['statement_descriptor'] = 'statement_descriptor'
      @_hash['currency'] = 'currency'
      @_hash['interval'] = 'interval'
      @_hash['interval_count'] = 'interval_count'
      @_hash['payment_methods'] = 'payment_methods'
      @_hash['billing_type'] = 'billing_type'
      @_hash['status'] = 'status'
      @_hash['shippable'] = 'shippable'
      @_hash['billing_days'] = 'billing_days'
      @_hash['metadata'] = 'metadata'
      @_hash['minimum_price'] = 'minimum_price'
      @_hash['trial_period_days'] = 'trial_period_days'
      @_hash
    end

    def initialize(name = nil,
                   description = nil,
                   installments = nil,
                   statement_descriptor = nil,
                   currency = nil,
                   interval = nil,
                   interval_count = nil,
                   payment_methods = nil,
                   billing_type = nil,
                   status = nil,
                   shippable = nil,
                   billing_days = nil,
                   metadata = nil,
                   minimum_price = nil,
                   trial_period_days = nil)
      @name = name
      @description = description
      @installments = installments
      @statement_descriptor = statement_descriptor
      @currency = currency
      @interval = interval
      @interval_count = interval_count
      @payment_methods = payment_methods
      @billing_type = billing_type
      @status = status
      @shippable = shippable
      @billing_days = billing_days
      @metadata = metadata
      @minimum_price = minimum_price
      @trial_period_days = trial_period_days
    end

    # Creates an instance of the object from a hash.
    def self.from_hash(hash)
      return nil unless hash

      # Extract variables from the hash.
      name = hash['name']
      description = hash['description']
      installments = hash['installments']
      statement_descriptor = hash['statement_descriptor']
      currency = hash['currency']
      interval = hash['interval']
      interval_count = hash['interval_count']
      payment_methods = hash['payment_methods']
      billing_type = hash['billing_type']
      status = hash['status']
      shippable = hash['shippable']
      billing_days = hash['billing_days']
      metadata = hash['metadata']
      minimum_price = hash['minimum_price']
      trial_period_days = hash['trial_period_days']

      # Create object from extracted values.
      UpdatePlanRequest.new(name,
                            description,
                            installments,
                            statement_descriptor,
                            currency,
                            interval,
                            interval_count,
                            payment_methods,
                            billing_type,
                            status,
                            shippable,
                            billing_days,
                            metadata,
                            minimum_price,
                            trial_period_days)
    end
  end
end
