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


class AddNewInterfaceParameterFields(SQLPacket):
    """Add the LOCKED and HIDDEN parameter to the Interface config table"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 14983

    sql_script = 'wi14983_new_interface_parameters.sql'

    def get_dependencies(self):
        return (MinVersionDependency(version='39.5.6', version_type=VersionType.CUSTOMIZING),
                MaxVersionDependency(version='39.5.6', version_type=VersionType.CUSTOMIZING))

    def fix(self, packet_runner):
        self.apply_rollback_ddl_file(self.sql_planta_de_dbms, self.sql_script, split=True)

        return self.success()