import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';

import '../../models/device/asset.dart';

class AssetInfoCard extends StatelessWidget {
  const AssetInfoCard({Key? key, required this.asset}) : super(key: key);

  final Asset asset;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        (asset.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "").heading5(context),
        8.height,
        "${context.translation.assetNo}: ${asset.assetNumber}".bodyText(context),
        "${context.translation.manufacture}: ${asset.modelDefinition?.manufacturerName}".bodyText(context),
        "${context.translation.model}: ${asset.modelDefinition?.modelName}".bodyText(context),
        "${context.translation.serialNumber}: ${asset.assetNumber}".bodyText(context),
        const Divider().defaultStyle(context),
        "${context.translation.department}: ${asset.department?.departmentName}".bodyText(context),
        "${context.translation.site}: ${asset.site?.custName}".bodyText(context),
      ],
    ).toShadowContainer(context);
  }
}
