package edu.kit.prog1314.shop;

import edu.kit.prog1314.shop.util.List;

/**
 * A class representing a purchase order.
 * 
 * @author Janis Schötterl-Glausch
 * @author Raphael von der Grün
 * @version 2
 */
public class Order {
    private String name;
    private List<Article> articles = new List<Article>();

    /**
     * Initializes the order.
     * 
     * @param name
     *            The identifier of the order.
     */
    public Order(String name) {
        this.name = name;
    }

    /**
     * Returns the articles in this order.
     * 
     * @return the articles
     */
    public List<Article> getArticles() {
        return articles;
    }

    @Override
    public boolean equals(Object object) {
        if (object != null && object instanceof Order) {
            return this.name.equals(((Order) object).name);
        }
        return false;
    }

    @Override
    public String toString() {
        return name + System.lineSeparator() + articles + System.lineSeparator();
    }
}
