Option Strict On
Option Explicit On

Imports System.Collections.Generic
Imports System.Collections.ObjectModel

Namespace Nexamas.UI.DataBinding

    ''' <summary>
    ''' Friend-only immutable snapshot of the visible pivot matrix. It is an export
    ''' model, not an Excel/PDF writer.
    ''' </summary>
    Friend NotInheritable Class MASPivotExportSnapshot
        Friend Sub New(rows As IEnumerable(Of String),
                       columns As IEnumerable(Of String),
                       cells As IEnumerable(Of MASPivotExportCell),
                       grandTotal As Decimal)
            Me.Rows = New ReadOnlyCollection(Of String)(If(rows Is Nothing, New List(Of String)(), New List(Of String)(rows)))
            Me.Columns = New ReadOnlyCollection(Of String)(If(columns Is Nothing, New List(Of String)(), New List(Of String)(columns)))
            Me.Cells = New ReadOnlyCollection(Of MASPivotExportCell)(If(cells Is Nothing, New List(Of MASPivotExportCell)(), New List(Of MASPivotExportCell)(cells)))
            Me.GrandTotal = grandTotal
        End Sub

        Friend ReadOnly Property Rows As IReadOnlyList(Of String)
        Friend ReadOnly Property Columns As IReadOnlyList(Of String)
        Friend ReadOnly Property Cells As IReadOnlyList(Of MASPivotExportCell)
        Friend ReadOnly Property GrandTotal As Decimal
    End Class

End Namespace
