# -*- coding: utf-8 -*-
from ppms.migration.packet import *


class ChangeInterfaceMappingTabOrder(ChangeDTPPacket):
    '''Change the tab order for the mapping elements in the interface'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 12028

    def fix(self, runner):

        # Typ
        record = self.get_record(411, ['053817', 745396], ['position'])
        if not self.change_value(record, 'position', 4, 3):
            return self.fail('Could not change position of "type" DF')

        # Objekt
        record = self.get_record(411, ['053817', 745397], ['position'])
        if not self.change_value(record, 'position', 3, 4):
            return self.fail('Could not change position of "object" DF')

        return self.success()
