<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<div class="h-8 flow-status border-b select-none">
    <div class="flex justify-between">
        <div class="flex flex-1 justify-around pr-20">
            @if (clusterSummary?.clustered) {
                <div class="flex items-center gap-x-2" title="Connected nodes / Total number of nodes in the cluster">
                    <div class="fa fa-cubes" [class]="getClusterStyle()"></div>
                    <div class="text">{{ formatClusterMessage() }}</div>
                </div>
            }
            <div class="flex items-center gap-x-2" [title]="getActiveThreadsTitle()">
                <div class="icon icon-threads" [class]="getActiveThreadsStyle()"></div>
                <div class="tertiary-color font-medium">{{ formatActiveThreads() }}</div>
            </div>
            <div class="flex items-center gap-x-2" title="Total queued data">
                <div class="fa fa-list" [class]="getQueuedStyle()"></div>
                <div class="tertiary-color font-medium">{{ controllerStatus.queued }}</div>
            </div>
            <div class="flex items-center gap-x-2" title="Transmitting Remote Process Groups">
                <div
                    class="fa fa-bullseye"
                    [class]="getActiveStyle(controllerStatus.activeRemotePortCount, 'success-color-variant')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.activeRemotePortCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Not Transmitting Remote Process Groups">
                <div
                    class="icon icon-transmit-false"
                    [class]="getActiveStyle(controllerStatus.inactiveRemotePortCount, 'neutral-color')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.inactiveRemotePortCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Running Components">
                <div
                    class="fa fa-play"
                    [class]="getActiveStyle(controllerStatus.runningCount, 'success-color-default')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.runningCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Stopped Components">
                <div
                    class="fa fa-stop"
                    [class]="getActiveStyle(controllerStatus.stoppedCount, 'error-color-variant')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.stoppedCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Invalid Components">
                <div
                    class="fa fa-warning invalid"
                    [class]="getActiveStyle(controllerStatus.invalidCount, 'caution-color')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.invalidCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Disabled Components">
                <div
                    class="icon icon-enable-false"
                    [class]="getActiveStyle(controllerStatus.disabledCount, 'neutral-color')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.disabledCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Up to date Versioned Process Groups">
                <div
                    class="fa fa-check"
                    [class]="getActiveStyle(controllerStatus.upToDateCount, 'success-color-default')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.upToDateCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Locally modified Versioned Process Groups">
                <div
                    class="fa fa-asterisk"
                    [class]="getActiveStyle(controllerStatus.locallyModifiedCount, 'neutral-color')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.locallyModifiedCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Stale Versioned Process Groups">
                <div
                    class="fa fa-arrow-circle-up"
                    [class]="getActiveStyle(controllerStatus.staleCount, 'error-color-variant')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.staleCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Locally modified and stale Versioned Process Groups">
                <div
                    class="fa fa-exclamation-circle"
                    [class]="
                        getActiveStyle(controllerStatus.locallyModifiedAndStaleCount, 'error-color-variant')
                    "></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.locallyModifiedAndStaleCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Sync failure Versioned Process Groups">
                <div
                    class="fa fa-question"
                    [class]="getActiveStyle(controllerStatus.syncFailureCount, 'neutral-color')"></div>
                <div class="tertiary-color font-medium">
                    {{ formatValue(controllerStatus.syncFailureCount) }}
                </div>
            </div>
            <div class="flex items-center gap-x-2" title="Last refresh">
                <div class="fa fa-refresh primary-color" [class.fa-spin]="loadingStatus"></div>
                <div class="tertiary-color font-medium">{{ lastRefreshed }}</div>
            </div>
        </div>
        <div class="flex">
            <search [currentProcessGroupId]="currentProcessGroupId"></search>
            <button
                class="flow-analysis-notifications w-8 border-l flex justify-center items-center pointer"
                (click)="toggleFlowAnalysis()"
                [ngClass]="flowAnalysisNotificationClass">
                <i class="fa fa-medkit"></i>
            </button>
            @if (hasBulletins()) {
                <button
                    nifiTooltip
                    [delayClose]="true"
                    [tooltipComponentType]="BulletinsTip"
                    [tooltipInputData]="getBulletins()"
                    [position]="getBulletinTooltipPosition()"
                    [ngClass]="getMostSevereBulletinLevel()"
                    class="h-8 w-8 controller-bulletins border-l has-bulletins">
                    <i class="fa fa-sticky-note-o"></i>
                </button>
            } @else {
                <button class="h-8 w-8 controller-bulletins border-l">
                    <i class="fa fa-sticky-note-o"></i>
                </button>
            }
        </div>
    </div>
</div>
