import {Text} from "pixi.js";
import HackAttachment from "../HackAttachment.js";
import {capitalizeFirstLetter, tryToApplyFallbackFontFamily} from "../../utils/utils";
import Locator from "../../services/Locator";
import AdvancedText from "../../utils/AdvancedText";

export default class TotalBetIndicator extends HackAttachment {

  createContent() {
    const label = new AdvancedText({key: "total_bet"}, {
      fontFamily: "Oxanium, Opensans",
      fill: 0xffffff,
      fontWeight: 400,
      fontSize: 12,
      align: "center",
    });
    label.anchor.set(0.5, 1);
    label.position.set(this.size.width * 0.5, this.size.height * 0.5);
    label.resolution = this.texture.resolution;

    const value = new Text("", {
      fontFamily: "Oxanium, Opensans",
      fill: 0xffffff,
      fontWeight: "bold",
      fontSize: 14,
      align: "center",
    });
    tryToApplyFallbackFontFamily(value);
    value.anchor.set(0.5, 0);
    value.position.set(this.size.width * 0.5, this.size.height * 0.5);
    value.resolution = this.texture.resolution;

    this.container.addChild(label, value);

    this.valueText = value;
  }

  set value(v) {
    this._value = v;
    this.valueText.text = v;
  }

  get value() {
    return this._value;
  }
}
