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

class RemoveUnnecessaryInterfaceTextconstant(BasePacket):
    '''Remove a text constant that was used in the interface logging'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 12391

    def get_dependencies(self):
        return DEFAULT_CUSTOMIZING_DEPENDENCY

    def fix(self, runner):
        constant_record = ppms.search_record(425, ['001654'], ['no_id'], True)
        if constant_record is None:
            self.fail('Text constant 001654 does not exist in this system')
            
        constant_record.delete()

        return self.success()
