module WolfCore::Integrations::ChangeDetection

def get_changed_custom_requirement_ids(payload)

def get_changed_custom_requirement_ids(payload)
  changed_custom_requirement_ids = []
  if payload['changes'].any?
    changed_custom_values = payload.dig('changes', 'custom_values')
    changed_custom_requirement_ids = if changed_custom_values.present?
      changed_custom_values.map do |changed_custom_value|
        changed_custom_value['custom_requirement_id'].to_s
      end
    else
      [payload.dig('attributes', 'custom_requirement_id').to_s]
    end
  end
  changed_custom_requirement_ids
end