import javax.swing.*;

public class Item extends ID
{
	private String title;
	private int copy;			//how many copies of book/cd do we have?
	private  boolean have;		//do we have at least one copy?

	public Item()
	{
	}

	public Item(int id, String title, int copy)
	{
		setID(id);
		setTitle(title);
		setNum_copies(copy);
		have = false;
		setHave();
	}


	public void setTitle(String title)  {this.title = title;}
	public void setNum_copies(int copy) {this.copy = copy;}
	public void setHave()
	{
		if (copy>0)
		{
			have = true;
		}
		else
		{
			have = false;
		}
	}

	public String   getTitle()      {return title;}
	public int      getNum_copies() {return copy;}
	public boolean  getHave()       {return have;}


	//--------------------check in/out
	public void checkIn()
	{
		have = true;
		setNum_copies(getNum_copies() + 1);		//copy++;
	}

	public void checkOut()
	{
		setNum_copies(getNum_copies() - 1);		//copy--
		if (getNum_copies() == 0)
		{
			have = false;
		}
	}


    //--------------------------------check if library has the book
	public String getCheckStatus()
	{
		if (have == true)
		{
			return "On shelf";
		}
		return "Checked out";
	}

	public String printItem()
	{
		return "";
	}

	public String ItemOut()
	{
		return getTitle();
	}
}
