import 'package:flutter/material.dart';

import 'score_overlay_bar.dart';

/// Punteggio in sola lettura sulla camera (la regia avviene via link web).
class CameraScoreControls extends StatelessWidget {
  const CameraScoreControls({
    super.key,
    required this.homeName,
    required this.awayName,
    required this.homePoints,
    required this.awayPoints,
    required this.currentSet,
    required this.homeSets,
    required this.awaySets,
    this.lastDelta,
    this.compact = false,
    this.pointsTarget,
  });

  final String homeName;
  final String awayName;
  final int homePoints;
  final int awayPoints;
  final int currentSet;
  final int homeSets;
  final int awaySets;
  final int? lastDelta;
  final bool compact;
  final int? pointsTarget;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      mainAxisSize: MainAxisSize.min,
      children: [
        ScoreOverlayBar(
          homeName: homeName,
          awayName: awayName,
          homePoints: homePoints,
          awayPoints: awayPoints,
          currentSet: currentSet,
          homeSets: homeSets,
          awaySets: awaySets,
          compact: compact,
          lastDelta: lastDelta,
          pointsTarget: pointsTarget,
        ),
        if (!compact) ...[
          const SizedBox(height: 8),
          Text(
            'Punteggio: condividi il link regia con chi gestisce il tabellone.',
            style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Colors.white54),
            textAlign: TextAlign.center,
          ),
        ],
      ],
    );
  }
}
