package com.tiedup.remake.state.components;

import com.tiedup.remake.util.tasks.ItemTask;

/**
 * Component responsible for player sale system.
 *
 * Single Responsibility: Sale state management
 * Complexity: LOW (simple state tracking)
 * Risk: LOW (isolated system)
 */
public class PlayerSale {

    // ========== Sale Fields ==========

    private boolean forSale = false;
    private ItemTask salePrice = null;

    // ========== Sale Methods ==========

    /**
     * Check if player is currently for sale.
     */
    public boolean isForSell() {
        return this.forSale && this.salePrice != null;
    }

    /**
     * Get the sale price.
     * @return The price, or null if not for sale
     */
    public ItemTask getSalePrice() {
        return this.salePrice;
    }

    /**
     * Put player up for sale with the given price.
     * @param price The sale price task
     */
    public void putForSale(ItemTask price) {
        if (price == null) return;
        this.forSale = true;
        this.salePrice = price;
    }

    /**
     * Cancel the sale and clear price.
     */
    public void cancelSale() {
        this.forSale = false;
        this.salePrice = null;
    }
}
