import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/svg.dart';

class LaserBodyParts {
  static final LaserBodyParts _instance = LaserBodyParts._internal();

  LaserBodyParts._internal();

  factory LaserBodyParts() => _instance;

  static Widget image(String assetUri) {
    return new SvgPicture.asset(assetUri, fit: BoxFit.cover, width: 88, height: 88);
  }

  static Widget imagePng(String assetUri) {
    return Image.asset(assetUri, fit: BoxFit.cover, width: 88, height: 88);
  }

  Map<String, Widget> maleBodyMap = {
    "1": imagePng("assets/images/new/body_parts/male/full_body_male.png"),
    "40": imagePng("assets/images/new/body_parts/male/upper_arm.png"),
    "41": imagePng("assets/images/new/body_parts/male/lower_arm.png"),
    "42": imagePng("assets/images/new/body_parts/male/chest.png"),
    "43": imagePng("assets/images/new/body_parts/male/chest_line.png"),
    "44": imagePng("assets/images/new/body_parts/male/shoulders.png"),
    "45": imagePng("assets/images/new/body_parts/male/back.png"),
    "46": imagePng("assets/images/new/body_parts/male/abdomin.png"),
    "47": imagePng("assets/images/new/body_parts/male/upper_legs.png"),
    "48": imagePng("assets/images/new/body_parts/male/lower_legs.png"),
    "49": imagePng("assets/images/new/body_parts/male/axilla.png")
  };

  Map<String, Widget> maleFaceMap = {
    "62": image("assets/images/new/body_parts/male/hydra_facial.svg"),
    "5": image("assets/images/new/body_parts/male/upper_lips.svg"),
    "6": image("assets/images/new/body_parts/male/chin.svg"),
    "7": image("assets/images/new/body_parts/male/cheek.svg"),
    "8": image("assets/images/new/body_parts/male/side_burn.svg"),
    "9": image("assets/images/new/body_parts/male/ears.svg"),
    "10": image("assets/images/new/body_parts/male/full_neck.svg"),
    "11": image("assets/images/new/body_parts/male/half_neck.svg"),
    "12": image("assets/images/new/body_parts/male/eyebrows.svg")
  };

  Map<String, Widget> maleBodyRetouchMap = {
    "50": imagePng("assets/images/new/body_parts/male/full_body_male.png"),
    "51": imagePng("assets/images/new/body_parts/male/upper_arm.png"),
    "52": imagePng("assets/images/new/body_parts/male/lower_arm.png"),
    "53": imagePng("assets/images/new/body_parts/male/chest.png"),
    "54": imagePng("assets/images/new/body_parts/male/shoulders.png"),
    "55": imagePng("assets/images/new/body_parts/male/back.png"),
    "56": imagePng("assets/images/new/body_parts/male/abdomin.png"),
    "57": imagePng("assets/images/new/body_parts/male/full_legs.png"),
    "58": imagePng("assets/images/new/body_parts/male/upper_legs.png"),
    "59": imagePng("assets/images/new/body_parts/male/lower_legs.png"),
    "60": imagePng("assets/images/new/body_parts/male/bikini.png"),
    "61": imagePng("assets/images/new/body_parts/male/bikini_line.png")
  };

  Map<String, Widget> femaleBodyMap = {
    "1": imagePng("assets/images/new/body_parts/female/full_body_female.png"),
    "40": imagePng("assets/images/new/body_parts/female/upper_arm.png"),
    "41": imagePng("assets/images/new/body_parts/female/lower_arm.png"),
    "42": imagePng("assets/images/new/body_parts/female/chest.png"),
    "43": imagePng("assets/images/new/body_parts/female/chest_line.png"),
    "44": imagePng("assets/images/new/body_parts/female/shoulders.png"),
    "45": imagePng("assets/images/new/body_parts/female/back.png"),
    "46": imagePng("assets/images/new/body_parts/female/abdomin.png"),
    "47": imagePng("assets/images/new/body_parts/female/upper_legs.png"),
    "48": imagePng("assets/images/new/body_parts/female/lower_leg.png"),
    "49": imagePng("assets/images/new/body_parts/female/axilla.png")
  };

  Map<String, Widget> femaleFaceMap = {
    "62": image("assets/images/new/body_parts/female/hydra_facial.svg"),
    "5": image("assets/images/new/body_parts/female/upper_lips.svg"),
    "6": image("assets/images/new/body_parts/female/chin.svg"),
    "7": image("assets/images/new/body_parts/female/cheeks.svg"),
    "8": image("assets/images/new/body_parts/female/side_burn.svg"),
    "9": image("assets/images/new/body_parts/female/ears.svg"),
    "10": image("assets/images/new/body_parts/female/full_neck.svg"),
    "11": image("assets/images/new/body_parts/female/half_neck.svg"),
    "12": image("assets/images/new/body_parts/female/eyebrows.svg")
  };

  Map<String, Widget> femaleBodyBikiniMap = {
    "34": imagePng("assets/images/new/body_parts/female/bikini.png"),
    "36": imagePng("assets/images/new/body_parts/female/bikini_line.png"),
    "38": imagePng("assets/images/new/body_parts/female/buttocks.png"),
    "39": imagePng("assets/images/new/body_parts/female/anal.png")
  };

  Map<String, Widget> femaleBodyRetouchMap = {
    "50": imagePng("assets/images/new/body_parts/female/full_body_female.png"),
    "51": imagePng("assets/images/new/body_parts/female/upper_arm.png"),
    "52": imagePng("assets/images/new/body_parts/female/lower_arm.png"),
    "53": imagePng("assets/images/new/body_parts/female/chest.png"),
    "54": imagePng("assets/images/new/body_parts/female/shoulders.png"),
    "55": imagePng("assets/images/new/body_parts/female/back.png"),
    "56": imagePng("assets/images/new/body_parts/female/abdomin.png"),
    "57": imagePng("assets/images/new/body_parts/female/full_legs.png"),
    "58": imagePng("assets/images/new/body_parts/female/upper_legs.png"),
    "59": imagePng("assets/images/new/body_parts/female/lower_leg.png"),
    "60": imagePng("assets/images/new/body_parts/female/bikini.png"),
    "61": imagePng("assets/images/new/body_parts/female/bikini_line.png")
  };

  Widget? getCategoryImage(bool isMale, int category, String mappingCode) {
    if (isMale) {
      if (category == 1) {
        return maleBodyMap![mappingCode]!;
      }
      if (category == 2) {
        return maleFaceMap![mappingCode]!;
      }
      if (category == 11) {
        return maleBodyRetouchMap![mappingCode]!;
      }
    } else {
      if (category == 1) {
        return femaleBodyMap![mappingCode]!;
      }
      if (category == 2) {
        return femaleFaceMap![mappingCode]!;
      }
      if (category == 10) {
        return femaleBodyBikiniMap![mappingCode]!;
      }
      if (category == 11) {
        return femaleBodyRetouchMap![mappingCode]!;
      }
    }
    return null;
  }
}
