module CTongEnum
    use COperationScenariosVariables
    implicit none
    contains
    
    subroutine Evaluate_Tong()
        implicit none
        
!        if (DriveType == TopDrive_DriveType) then
!#ifdef OST
!            print*, 'Evaluate_Tong=TopDrive'
!#endif
!        endif
!        
!        
!        
!        
!        
!        
!        
!        
!        if (DriveType == Kelly_DriveType) then
!#ifdef OST
!            print*, 'Evaluate_Tong=Kelly'
!#endif
!        endif
        
    end subroutine
    
    ! subroutine Subscribe_Tong()
    !     use CDrillingConsoleVariables
    !     implicit none
        
    !     call OnBreakoutLeverPress%Add(ButtonPress_Breakout_TongNotification)
    !     call OnMakeupLeverPress%Add(ButtonPress_Makeup_TongNotification)
    !     call OnTongNeutralPress%Add(ButtonPress_Neutral_TongNotification)
        
    ! end subroutine
    
    
    
    subroutine ButtonPress_Breakout_TongNotification()
        implicit none
        
        
        
        
        
        
        
        if (Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'ButtonPress_Breakout_TongNotification=TopDrive'
#endif

            !TOPDRIVE-CODE=70
            if (Get_TongNotification()) then
                
                call Set_Tong(TONG_BREAKOUT_BEGIN)
                return
            end if


        endif
        
        
        
        
        
        
        
        
        if (Hoisting%DriveType == Kelly_DriveType) then
#ifdef OST
            print*, 'ButtonPress_Breakout_TongNotification=Kelly'
#endif


            !OPERATION-CODE=74
            if (Get_TongNotification()) then
                call Set_Tong(TONG_BREAKOUT_BEGIN)
            endif





        endif
        
        
        
        
        
        
        
        
        
        
        
    end subroutine
    
    
    
    
    
    
    
    subroutine ButtonPress_Makeup_TongNotification()
        use NotificationVariables
        implicit none
        
        
        
        if (Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'ButtonPress_Makeup_TongNotification=TopDrive'
#endif


            !TOPDRIVE-CODE=69
            if (Get_TongNotification()) then
                
                call Set_Tong(TONG_MAKEUP_BEGIN)
                return
            end if

        endif
        
        
        
        
        
        
        
        
        if (Hoisting%DriveType == Kelly_DriveType) then
#ifdef OST
            print*, 'ButtonPress_Makeup_TongNotification=Kelly'
#endif


            !OPERATION-CODE=73
            if (Get_TongNotification()) then
                call Set_Tong(TONG_MAKEUP_BEGIN)
            endif

        endif
        
        
        
        
        
        
        
        
    end subroutine
    
    subroutine ButtonPress_Neutral_TongNotification()
        implicit none
        
        
        
        if (Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'ButtonPress_Neutral_TongNotification=TopDrive'
#endif
        endif
        
        
        
        
        
        
        
        
        if (Hoisting%DriveType == Kelly_DriveType) then
#ifdef OST
            print*, 'ButtonPress_Neutral_TongNotification=Kelly'
#endif

            call Set_Tong(TONG_NEUTRAL)
            
            
        endif
        
        
    end subroutine
    
end module CTongEnum