# -*- coding: utf-8 -*-
from ppms.migration import SQLPacket, PacketCategory, MaxVersionDependency, VersionType, PacketDependency, \
    PacketState

PACKET_PATH = 'migration.hotfix.S_39_5_4.wi11533_port_universal_interface_VoE.PortCustomizingUniversalInterface'


class PortInterfacePagination(SQLPacket):
    """Port the new pagination customizing for the PLANTA Link logging"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 13337

    FILENAME = 'wi13337_interface_paging.sql'

    def get_dependencies(self):
        return (MaxVersionDependency(version='39.5.5', version_type=VersionType.CUSTOMIZING),
                PacketDependency(packet_path=PACKET_PATH, expected_state=PacketState.INSTALLED))

    def fix(self, runner):
        self.apply_dml_file(self.sql_planta_de_dbms, self.FILENAME)

        return self.success()