Imports System.ComponentModel
Imports DigitalData.GUIs.ClientSuite

Public Class WorkflowItem
    Implements INotifyPropertyChanged

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Private _state As String

    Public Property Title As String
    Public Property CreatedAt As DateTime
    Public Property Process As String
    Public Property Raw As DataRow

    Public Property IconMap As Dictionary(Of String, String)
    Public Property StateImage As Image
    Public Property State As String
        Get
            Return _state
        End Get
        Set(value As String)
            _state = value
            StateImage = GetIcon(value, IconMap)
        End Set
    End Property

    Public Sub New(IconMap As Dictionary(Of String, String))
        Me.IconMap = IconMap
    End Sub



    Private Function GetIcon(StateName As String, IconMap As Dictionary(Of String, String)) As Image
        If IconMap.ContainsKey(StateName) Then
            Dim IconName = IconMap.Item(StateName)
            Return My.Resources.ResourceManager.GetObject(IconName)
        Else
            Return Nothing
        End If
    End Function
End Class
