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


class DeleteObsoleteInterfaceTextConstants_02(BasePacket):
    '''Delete obsolete text constants that were used in the interface'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 12675

    def get_dependencies(self):
        return DEFAULT_CUSTOMIZING_DEPENDENCY

    def fix(self, runner):
        for text_constant in ('001604', '001605'):
            constant_record = ppms.search_record(425, [text_constant], ['no_id'])
            if constant_record:
                constant_record.delete()

        return self.success()
