package ru.mai.pmoproject;

import java.util.List;

/**
 * Created by stud on 16.04.2015.
 */
public class Book {
    String Name;
    String Author;
    List<Integer> ID = new List<Integer>();
    Integer quantity;

    public Book(String Name, String Author, Integer quantity){
        if (Name==null||Name.trim().length() == 0) {
            throw new IllegalArgumentException("Нет названия");
        }
        if (quantity<=0) {
            throw new IllegalArgumentException("Для внесения книг должно быть больше 0");
        }
        this.Name=Name;
        this.Author=Author;
        this.quantity=quantity;
        ID=getID(quantity);
    }

    @Override
    public String toString() {
        return "Book{" +
                "Name='" + Name + '\'' +
                ", Author='" + Author + '\'' +
                ", ID=" + ID +
                ", quantity=" + quantity +
                '}';
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getAuthor() {
        return Author;
    }

    public void setAuthor(String author) {
        Author = author;
    }

    public List<Integer> getID(Integer quantity) {
        for (int i=1; i<=quantity; i++)
        {
            i= ID[i];
        }
        return ID;
        }



    public void setID(List<Integer> ID) {
        this.ID = ID;
    }
}
