Option Strict On
Option Explicit On

Imports System.Collections.Generic
Imports System.Linq

Namespace Nexamas.UI.Motion

    ''' <summary>
    ''' Motion integration report proving that current animation-heavy surfaces are bound to MASMotionSystem.
    ''' </summary>
    Friend NotInheritable Class MASMotionIntegrationReport

        Friend Sub New(bindings As IReadOnlyList(Of MASMotionConsumerBinding), findings As IReadOnlyList(Of MASMotionIntegrationFinding))
            Me.Bindings = If(bindings IsNot Nothing, bindings, CType(New List(Of MASMotionConsumerBinding)(), IReadOnlyList(Of MASMotionConsumerBinding)))
            Me.Findings = If(findings IsNot Nothing, findings, CType(New List(Of MASMotionIntegrationFinding)(), IReadOnlyList(Of MASMotionIntegrationFinding)))
        End Sub

        Friend ReadOnly Property Bindings As IReadOnlyList(Of MASMotionConsumerBinding)

        Friend ReadOnly Property Findings As IReadOnlyList(Of MASMotionIntegrationFinding)

        Friend ReadOnly Property ConsumerCount As Integer
            Get
                Return Bindings.Count
            End Get
        End Property

        Friend ReadOnly Property DeclaredOnlyConsumerCount As Integer
            Get
                Return Global.System.Linq.Enumerable.Count(Bindings, Function(binding) binding IsNot Nothing AndAlso binding.IsDeclaredOnly)
            End Get
        End Property

        Friend ReadOnly Property RuntimeProvenConsumerCount As Integer
            Get
                Return Global.System.Linq.Enumerable.Count(Bindings, Function(binding) binding IsNot Nothing AndAlso binding.IsRuntimeProven)
            End Get
        End Property

        Friend ReadOnly Property TimelineRunnerConsumerCount As Integer
            Get
                Return Global.System.Linq.Enumerable.Count(Bindings, Function(binding) binding IsNot Nothing AndAlso binding.UsesTimelineRunner)
            End Get
        End Property

        Friend ReadOnly Property FrameConsumerCount As Integer
            Get
                Return Global.System.Linq.Enumerable.Count(Bindings, Function(binding) binding IsNot Nothing AndAlso binding.ConsumesFrameClock)
            End Get
        End Property

        Friend ReadOnly Property FloatRuntimeInheritedConsumerCount As Integer
            Get
                Return Global.System.Linq.Enumerable.Count(Bindings, Function(binding) binding IsNot Nothing AndAlso binding.IsFloatRuntimeInherited)
            End Get
        End Property

        Friend ReadOnly Property IsReady As Boolean
            Get
                Return Not Findings.Any()
            End Get
        End Property

    End Class

End Namespace
