module CTdsSpineEnum
    use OperationScenariosModule
    use UnitySignalsModule !for CTdsConnectionModesEnum, only:Get_TdsConnectionModes
    implicit none
    contains
    
    subroutine Evaluate_TdsSpine()
        implicit none
        
        if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'Evaluate_TdsSpine=TopDrive'
#endif

            !TOPDRIVE-CODE=83
            if (Get_TdsStemIn() .and.&
                Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.&
                !Get_TdsConnectionPossible() .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == TdsPower_FWD .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_SPINE) then
            
                call Set_TdsSpine(TDS_SPINE_CONNECT_BEGIN)
                return
            end if
                
            !TOPDRIVE-CODE=84
            if (Get_TdsStemIn() .and.&
                Get_TdsTong() == TDS_TONG_BREAKOUT_END .and.&
                Get_TdsConnectionModes() == TDS_CONNECTION_SPINE .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == TdsPower_REV .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_SPINE) then
            
                call Set_TdsSpine(TDS_SPINE_DISCONNECT_BEGIN)
                return
            end if



        endif
        
        
        
        
        
        
        
        
        
        if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
#ifdef OST
            print*, 'Evaluate_TdsSpine=Kelly'
#endif
        endif
        
    end subroutine
    
    subroutine Subscribe_TdsSpine()
        use CDrillingConsoleVariables
    use SimulationVariables
    use SimulationVariables
        implicit none
    end subroutine
    
end module CTdsSpineEnum