import 'package:flutter/material.dart';
import 'package:garage/insurance/model/currency.dart';

import '../../utils/date_time_utils.dart';
import '../model/insurance.dart';

class InsuranceRow extends StatelessWidget {
  final Insurance insurance;

  const InsuranceRow({super.key, required this.insurance});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: Container(
        decoration: BoxDecoration(
          color: Colors.green,
          border: Border.all(color: Colors.teal),
        ),
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            children: [
              Row(
                children: [
                  Text(insurance.company),
                  Spacer(),
                  Text(insurance.contractNumber),
                ],
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(getShortDate(insurance.expirationDate)),
                  Spacer(),
                  Text(
                    "${insurance.amount} ${insurance.currency.symbol}",
                    style: TextStyle(fontWeight: FontWeight.bold),
                  )
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}
