package components;

import javafx.scene.control.Label;
import javafx.scene.layout.HBox;

public class NumberStatRow extends HBox {
    String text;
    int value;

    Label textLabel = new Label();
    Label valueLabel = new Label();

    public NumberStatRow(String text, int value) {
        this.text = text;
        this.value = value;

        textLabel.setText(text);
        valueLabel.setText(String.valueOf(value));
        this.getChildren().add(textLabel);
        this.getChildren().add(valueLabel);
    }

    public void increaseValue(int valueToAdd) {
        value += valueToAdd;
        updateValueLabel();
    }

    public void decreaseValue(int valueToSubtract) {
        value -= valueToSubtract;
        updateValueLabel();
    }

    public void increaseValue() {
        value++;
        updateValueLabel();
    }

    public void decreaseValue() {
        value--;
        updateValueLabel();
    }

    private void updateValueLabel() {
        valueLabel.setText(String.valueOf(value));
    }


    public int getValue() {
        return value;
    }
}