package com.yourname.premiumah.gui;

import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;

public final class SellSession {
    private ItemStack item;
    private double price;
    private volatile boolean awaitingPrice;
    private volatile boolean completed;
    private BukkitTask timeoutTask;

    public ItemStack item() {
        return item == null ? null : item.clone();
    }

    public ItemStack rawItem() {
        return item;
    }

    public void item(ItemStack item) {
        this.item = item == null ? null : item.clone();
    }

    public double price() {
        return price;
    }

    public void price(double price) {
        this.price = price;
    }

    public boolean awaitingPrice() {
        return awaitingPrice;
    }

    public void awaitingPrice(boolean awaitingPrice) {
        this.awaitingPrice = awaitingPrice;
    }

    public boolean completed() {
        return completed;
    }

    public void completed(boolean completed) {
        this.completed = completed;
    }

    public BukkitTask timeoutTask() {
        return timeoutTask;
    }

    public void timeoutTask(BukkitTask timeoutTask) {
        this.timeoutTask = timeoutTask;
    }

    public void cancelTimeout() {
        if (timeoutTask != null) {
            timeoutTask.cancel();
            timeoutTask = null;
        }
    }
}
