Imports System.Configuration

Public Class AppConfig
    Public FirebirdDataSource As String
    Public FirebirdDatabase As String
    Public FirebirdUser As String
    Public FirebirdPassword As String
    Public ContainerPath As String
    Public ContainerPassword As String
    Public DatastorePath As String
    Public MSSQLConnectionString As String

    Public Sub New()
        With ConfigurationManager.AppSettings
            FirebirdDataSource = .Item("FIREBIRD_DATASOURCE")
            FirebirdDatabase = .Item("FIREBIRD_DATABASE_NAME")
            FirebirdUser = .Item("FIREBIRD_DATABASE_USER")
            FirebirdPassword = .Item("FIREBIRD_DATABASE_PASS")

            MSSQLConnectionString = .Item("MSSQL_CONNECTION_STRING")

            ContainerPath = .Item("CONTAINER_PATH")
            ContainerPassword = .Item("CONTAINER_PASSWORD")

            DatastorePath = .Item("DATASTORE_PATH")
        End With
    End Sub

    Public Function IsFirebirdConfigured() As Boolean
        Dim oProps As New List(Of String) From {FirebirdDataSource, FirebirdDatabase, FirebirdUser, FirebirdPassword}
        Return Not oProps.Any(Function(Prop) String.IsNullOrWhiteSpace(Prop))
    End Function

    Public Function IsMSSQLConfigured() As Boolean
        Return Not String.IsNullOrWhiteSpace(MSSQLConnectionString)
    End Function
End Class
