Imports UTS_Core.UTSModule.Service

Public Class TaskForms
    Private ReadOnly _taskForms As List(Of ITaskForm)

    Private ReadOnly _status As List(Of ServiceTask.ServiceTaskStatusEnum)


    Sub New()
        _taskForms = New List(Of ITaskForm)()
        _status = New List(Of ServiceTask.ServiceTaskStatusEnum)()
    End Sub


    Public Sub SetStatus(index As Integer, status As ServiceTask.ServiceTaskStatusEnum)
        _status(index) = status
    End Sub


    Public Function GetStatus(index As Integer) As ServiceTask.ServiceTaskStatusEnum

        Return _status(index)
    End Function


    Public Sub Add(taskForm As ITaskForm)
        _taskForms.Add(taskForm)
        _status.Add(ServiceTask.ServiceTaskStatusEnum.Stop)
    End Sub

    Public Sub RemoveAt(index As Integer)
        _taskForms.RemoveAt(index)
        _status.RemoveAt(index)
    End Sub


    Public Sub Clear()
        _taskForms.Clear()
        _status.Clear()
    End Sub


    Public Function GetParams(index As Integer) As Dictionary(Of String, String)
        Return _taskForms(index).GetParams()
    End Function

    Public Sub SetParams(index As Integer, params As Dictionary(Of String, String))
        _taskForms(index).SetParam(params)
    End Sub
End Class
