module Eancom module Edifact class ALC < Segment TAG = 'ALC'.freeze TYPE = :body.freeze attr_reader :segment_type def initialize( tag: nil, allowance_or_charge_code_qualifier:, allowance_or_charge_identifier: nil, allowance_or_charge_identification_code: nil, settlement_mean_code: nil, calculation_sequence_code: nil, special_service_description_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil, special_service_description_1: nil, special_service_description_2: nil ) @tag = tag @allowance_or_charge_code_qualifier = allowance_or_charge_code_qualifier @allowance_or_charge_identifier = allowance_or_charge_identifier @allowance_or_charge_identification_code = allowance_or_charge_identification_code @settlement_mean_code = settlement_mean_code @calculation_sequence_code = calculation_sequence_code @special_service_description_code = special_service_description_code @code_list_identification_code = code_list_identification_code @code_list_responsible_agency_code = code_list_responsible_agency_code @special_service_description_1 = special_service_description_1 @special_service_description_2 = special_service_description_2 super(tag: tag || TAG) end def to_json_hash hash = {} hash.merge!(allowance_or_charge_code_qualifier: find_identifier(:allowance_or_charge_code_qualifier)) if @allowance_or_charge_code_qualifier hash.merge!(allowance_or_charge_identifier: @allowance_or_charge_identifier) if @allowance_or_charge_identifier hash.merge!(allowance_or_charge_identification_code: find_identifier(:allowance_or_charge_identification_code)) if @allowance_or_charge_identification_code hash.merge!(settlement_mean_code: find_identifier(:settlement_mean_code)) if @settlement_mean_code hash.merge!(calculation_sequence_code: find_identifier(:calculation_sequence_code)) if @calculation_sequence_code hash.merge!(special_service_description_code: find_identifier(:special_service_description_code)) if @special_service_description_code hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code hash.merge!(code_list_responsible_agency_code: find_identifier(:code_list_responsible_agency_code)) if @code_list_responsible_agency_code hash.merge!(special_service_description_1: @special_service_description_1) if @special_service_description_1 hash.merge!(special_service_description_2: @special_service_description_2) if @special_service_description_2 hash end def group_name 'allowances_or_charges' end def segment_type TYPE end end end end