# LINE Messaging API
# This document describes LINE Messaging API.
#
# The version of the OpenAPI document: 0.0.1
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.

module Line
  module Bot
    module V2
      module MessagingApi
        # Detailed information about a coupon, including all properties and current status.
        class CouponResponse
          # @!attribute [rw] acquisition_condition
          #   @return [AcquisitionConditionResponse,nil] 
          attr_accessor :acquisition_condition
          # @!attribute [rw] barcode_image_url
          #   @return [String,nil] URL of the barcode image associated with the coupon. Used for in-store redemption.
          attr_accessor :barcode_image_url
          # @!attribute [rw] coupon_code
          #   @return [String,nil] Unique code to be presented by the user to redeem the coupon.
          attr_accessor :coupon_code
          # @!attribute [rw] description
          #   @return [String,nil] Detailed description of the coupon. Displayed to users.
          attr_accessor :description
          # @!attribute [rw] end_timestamp
          #   @return [Integer,nil] Coupon expiration time (epoch seconds). Coupon cannot be used after this time.
          attr_accessor :end_timestamp
          # @!attribute [rw] image_url
          #   @return [String,nil] URL of the main image representing the coupon. Displayed in the coupon list.
          attr_accessor :image_url
          # @!attribute [rw] max_acquire_count
          #   @return [Integer,nil] Maximum number of coupons that can be issued in total.
          attr_accessor :max_acquire_count
          # @!attribute [rw] max_use_count_per_ticket
          #   @return [Integer,nil] Maximum number of times a single coupon ticket can be used.
          attr_accessor :max_use_count_per_ticket
          # @!attribute [rw] max_ticket_per_user
          #   @return [Integer,nil] Maximum number of coupon tickets a single user can acquire.
          attr_accessor :max_ticket_per_user
          # @!attribute [rw] start_timestamp
          #   @return [Integer,nil] Coupon start time (epoch seconds). Coupon can be used from this time.
          attr_accessor :start_timestamp
          # @!attribute [rw] title
          #   @return [String,nil] Title of the coupon. Displayed in the coupon list.
          attr_accessor :title
          # @!attribute [rw] usage_condition
          #   @return [String,nil] Conditions for using the coupon. Shown to users.
          attr_accessor :usage_condition
          # @!attribute [rw] reward
          #   @return [CouponRewardResponse,nil] 
          attr_accessor :reward
          # @!attribute [rw] visibility
          #   @return [String,nil] ('UNLISTED'|'PUBLIC'|'PRIVATE') Visibility of the coupon. Determines who can see or acquire the coupon.
          attr_accessor :visibility
          # @!attribute [rw] timezone
          #   @return [String,nil] ('ETC_GMT_MINUS_12'|'ETC_GMT_MINUS_11'|'PACIFIC_HONOLULU'|'AMERICA_ANCHORAGE'|'AMERICA_LOS_ANGELES'|'AMERICA_PHOENIX'|'AMERICA_CHICAGO'|'AMERICA_NEW_YORK'|'AMERICA_CARACAS'|'AMERICA_SANTIAGO'|'AMERICA_ST_JOHNS'|'AMERICA_SAO_PAULO'|'ETC_GMT_MINUS_2'|'ATLANTIC_CAPE_VERDE'|'EUROPE_LONDON'|'EUROPE_PARIS'|'EUROPE_ISTANBUL'|'EUROPE_MOSCOW'|'ASIA_TEHRAN'|'ASIA_TBILISI'|'ASIA_KABUL'|'ASIA_TASHKENT'|'ASIA_COLOMBO'|'ASIA_KATHMANDU'|'ASIA_ALMATY'|'ASIA_RANGOON'|'ASIA_BANGKOK'|'ASIA_TAIPEI'|'ASIA_TOKYO'|'AUSTRALIA_DARWIN'|'AUSTRALIA_SYDNEY'|'ASIA_VLADIVOSTOK'|'ETC_GMT_PLUS_12'|'PACIFIC_TONGATAPU') Timezone for interpreting start and end timestamps.
          attr_accessor :timezone
          # @!attribute [rw] coupon_id
          #   @return [String,nil] Unique identifier of the coupon.
          attr_accessor :coupon_id
          # @!attribute [rw] created_timestamp
          #   @return [Integer,nil] Created timestamp (seconds) of the coupon.
          attr_accessor :created_timestamp
          # @!attribute [rw] status
          #   @return [String,nil] ('DRAFT'|'RUNNING'|'CLOSED') Current status of the coupon.
          attr_accessor :status

          # @param acquisition_condition [AcquisitionConditionResponse, Hash[Symbol, untyped], nil] 
          # @param barcode_image_url [String,nil] URL of the barcode image associated with the coupon. Used for in-store redemption.
          # @param coupon_code [String,nil] Unique code to be presented by the user to redeem the coupon.
          # @param description [String,nil] Detailed description of the coupon. Displayed to users.
          # @param end_timestamp [Integer,nil] Coupon expiration time (epoch seconds). Coupon cannot be used after this time.
          # @param image_url [String,nil] URL of the main image representing the coupon. Displayed in the coupon list.
          # @param max_acquire_count [Integer,nil] Maximum number of coupons that can be issued in total.
          # @param max_use_count_per_ticket [Integer,nil] Maximum number of times a single coupon ticket can be used.
          # @param max_ticket_per_user [Integer,nil] Maximum number of coupon tickets a single user can acquire.
          # @param start_timestamp [Integer,nil] Coupon start time (epoch seconds). Coupon can be used from this time.
          # @param title [String,nil] Title of the coupon. Displayed in the coupon list.
          # @param usage_condition [String,nil] Conditions for using the coupon. Shown to users.
          # @param reward [CouponRewardResponse, Hash[Symbol, untyped], nil] 
          # @param visibility [String,nil] ('UNLISTED'|'PUBLIC'|'PRIVATE') Visibility of the coupon. Determines who can see or acquire the coupon.
          # @param timezone [String,nil] ('ETC_GMT_MINUS_12'|'ETC_GMT_MINUS_11'|'PACIFIC_HONOLULU'|'AMERICA_ANCHORAGE'|'AMERICA_LOS_ANGELES'|'AMERICA_PHOENIX'|'AMERICA_CHICAGO'|'AMERICA_NEW_YORK'|'AMERICA_CARACAS'|'AMERICA_SANTIAGO'|'AMERICA_ST_JOHNS'|'AMERICA_SAO_PAULO'|'ETC_GMT_MINUS_2'|'ATLANTIC_CAPE_VERDE'|'EUROPE_LONDON'|'EUROPE_PARIS'|'EUROPE_ISTANBUL'|'EUROPE_MOSCOW'|'ASIA_TEHRAN'|'ASIA_TBILISI'|'ASIA_KABUL'|'ASIA_TASHKENT'|'ASIA_COLOMBO'|'ASIA_KATHMANDU'|'ASIA_ALMATY'|'ASIA_RANGOON'|'ASIA_BANGKOK'|'ASIA_TAIPEI'|'ASIA_TOKYO'|'AUSTRALIA_DARWIN'|'AUSTRALIA_SYDNEY'|'ASIA_VLADIVOSTOK'|'ETC_GMT_PLUS_12'|'PACIFIC_TONGATAPU') Timezone for interpreting start and end timestamps.
          # @param coupon_id [String,nil] Unique identifier of the coupon.
          # @param created_timestamp [Integer,nil] Created timestamp (seconds) of the coupon.
          # @param status [String,nil] ('DRAFT'|'RUNNING'|'CLOSED') Current status of the coupon.
          def initialize(
            acquisition_condition: nil,
            barcode_image_url: nil,
            coupon_code: nil,
            description: nil,
            end_timestamp: nil,
            image_url: nil,
            max_acquire_count: nil,
            max_use_count_per_ticket: nil,
            max_ticket_per_user: nil,
            start_timestamp: nil,
            title: nil,
            usage_condition: nil,
            reward: nil,
            visibility: nil,
            timezone: nil,
            coupon_id: nil,
            created_timestamp: nil,
            status: nil,
            **dynamic_attributes
          )
            
            @acquisition_condition = acquisition_condition.is_a?(Line::Bot::V2::MessagingApi::AcquisitionConditionResponse) || acquisition_condition.nil? ? acquisition_condition : Line::Bot::V2::MessagingApi::AcquisitionConditionResponse.create(**acquisition_condition) # steep:ignore
            @barcode_image_url = barcode_image_url
            @coupon_code = coupon_code
            @description = description
            @end_timestamp = end_timestamp
            @image_url = image_url
            @max_acquire_count = max_acquire_count
            @max_use_count_per_ticket = max_use_count_per_ticket
            @max_ticket_per_user = max_ticket_per_user
            @start_timestamp = start_timestamp
            @title = title
            @usage_condition = usage_condition
            @reward = reward.is_a?(Line::Bot::V2::MessagingApi::CouponRewardResponse) || reward.nil? ? reward : Line::Bot::V2::MessagingApi::CouponRewardResponse.create(**reward) # steep:ignore
            @visibility = visibility
            @timezone = timezone
            @coupon_id = coupon_id
            @created_timestamp = created_timestamp
            @status = status

            dynamic_attributes.each do |key, value|
              self.class.attr_accessor key

              if value.is_a?(Hash)
                struct_klass = Struct.new(*value.keys.map(&:to_sym))
                struct_values = value.map { |_k, v| v.is_a?(Hash) ? Line::Bot::V2::Utils.hash_to_struct(v) : v }
                instance_variable_set("@#{key}", struct_klass.new(*struct_values))
              else
                instance_variable_set("@#{key}", value)
              end
            end
          end

          # Create an instance of the class from a hash
          # @param args [Hash] Hash containing all the required attributes
          # @return [Line::Bot::V2::MessagingApi::CouponResponse] Instance of the class
          def self.create(args) # steep:ignore
            symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args)
            return new(**symbolized_args) # steep:ignore
          end

          # @param other [Object] Object to compare
          # @return [Boolean] true if the objects are equal, false otherwise
          def ==(other)
            return false unless self.class == other.class

            instance_variables.all? do |var|
                instance_variable_get(var) == other.instance_variable_get(var)
            end
          end

          # @return [Integer] Hash code of the object
          def hash
            [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash
          end
        end
      end
    end
  end
end
