import 'package:flutter/material.dart';

import '../../../../theming/app_theme.dart';
import '../widgets/bubble.dart';

extension ColorExtensions on Color {
  Color withWhite(int whiteValue) {
    final value = whiteValue / 255.0;
    return Color.from(alpha: a, red: value, green: value, blue: value);
  }
}

class ChatBubbleStyles {
  final BuildContext context;

  ChatBubbleStyles(this.context);

  BubbleStyle getSystemStyle() => BubbleStyle(
    color: AppTheme.isDarkMode(context)
        ? const Color(0xff182229)
        : Colors.white,
    elevation: 2,
    margin: const BubbleEdges.only(bottom: 20, top: 10),
    alignment: Alignment.center,
  );

  BubbleStyle getRemoteStyle() => BubbleStyle(
    nip: BubbleNip.leftTop,
    color: AppTheme.isDarkMode(context)
        ? const Color(0xff202c33)
        : Colors.white,
    elevation: 1,
    margin: const BubbleEdges.only(bottom: 10, left: 10, right: 50),
    alignment: Alignment.topLeft,
  );

  BubbleStyle getSelfStyle() => BubbleStyle(
    nip: BubbleNip.rightBottom,
    color: AppTheme.isDarkMode(context)
        ? const Color(0xff005c4b)
        : const Color(0xffd3d3d3),
    elevation: 1,
    margin: const BubbleEdges.only(bottom: 10, right: 10, left: 50),
    alignment: Alignment.topRight,
  );
}
