Imports System.Threading

Namespace State
    ''' <summary>
    ''' Helper Class to hold User State
    ''' </summary>
    Public Class UserState
        Public Const LANG_DE_DE As String = "de-DE"
        Public Const LANG_EN_US As String = "en-US"

        ''' <summary>
        ''' Numeric UserId, ex. 1
        ''' </summary>
        Public Property UserId As Integer

        ''' <summary>
        ''' The windows username, ex. JenneJ
        ''' </summary>
        ''' <returns></returns>
        Public Property UserName As String

        ''' <summary>
        ''' The user's surname, ex. Jenne
        ''' </summary>
        Public Property Surname As String

        ''' <summary>
        ''' The user's given name, ex. Jonathan
        ''' </summary>
        Public Property GivenName As String

        ''' <summary>
        ''' The shortname given to the user, ex. JJ
        ''' </summary>
        Public Property ShortName As String

        ''' <summary>
        ''' The user's email address
        ''' </summary>
        Public Property Email As String

        ''' <summary>
        ''' The user's windows machine name, ex. DD-PC-ENT04
        ''' </summary>
        Public Property MachineName As String

        ''' <summary>
        ''' The users preferred date format, ex. dd-MM-yyyy
        ''' </summary>
        Public Property DateFormat As String

        ''' <summary>
        ''' The user's language code, ex. de-DE
        ''' </summary>
        Public Property Language As String

        ''' <summary>
        ''' The user's language id, what is this?
        ''' </summary>
        Public Property LanguageId As Integer

        ''' <summary>
        ''' Is the user a general administrator?
        ''' </summary>
        ''' <returns></returns>
        Public Property IsAdmin As Boolean = False

        ''' <summary>
        ''' Should basic config (DB Settings) be hidden from this user?
        ''' </summary>
        ''' <returns></returns>
        Public Property HideBasicConfig As Boolean = False

        ''' <summary>
        ''' Initialize user object with values that can be read from the environment. Only meant for Global Application State
        ''' </summary>
        Public Sub New()
            Language = Thread.CurrentThread.CurrentCulture.Name
            UserName = System.Environment.UserName
            MachineName = System.Environment.MachineName
        End Sub

        ''' <summary>
        ''' Initialize user object with user name. Mandatory for sending user data between systems.
        ''' </summary>
        Public Sub New(pUserName As String)
            MyBase.New()
            UserName = pUserName
        End Sub
    End Class
End Namespace

