/*
 * Copyright 2008-2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.broadleafcommerce.order.service.call;

import org.broadleafcommerce.catalog.domain.Category;
import org.broadleafcommerce.catalog.domain.Product;
import org.broadleafcommerce.catalog.domain.Sku;

public class DiscreteOrderItemRequest {

    private Sku sku;
    private Category category;
    private Product product;
    private int quantity;

    public Sku getSku() {
        return sku;
    }

    public void setSku(Sku sku) {
        this.sku = sku;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public int getQuantity() {
        return quantity;
    }

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

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof DiscreteOrderItemRequest)) return false;

        DiscreteOrderItemRequest that = (DiscreteOrderItemRequest) o;

        if (!category.equals(that.category)) return false;
        if (!product.equals(that.product)) return false;
        if (quantity != that.quantity) return false;
        if (!sku.equals(that.sku)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = product != null ? product.hashCode() : 0;
        result = 31 * result + (category != null ? category.hashCode() : 0);
        result = 31 * result + (sku != null ? sku.hashCode() : 0);
        result = 31 * result + quantity;
        return result;
    }

}

@@ -820,16 +820,75 @@
 ain.Sku;
+%0Aimport org.broadleafcommerce.order.domain.PersonalMessage;
 %0A%0Apublic
@@ -1028,16 +1028,61 @@
 uantity;
+%0A    private PersonalMessage personalMessage;
 %0A%0A    pu
@@ -2444,10 +2444,223 @@
 %0A    %7D%0A%0A
+    public PersonalMessage getPersonalMessage() %7B%0A        return personalMessage;%0A    %7D%0A%0A    public void setPersonalMessage(PersonalMessage personalMessage) %7B%0A        this.personalMessage = personalMessage;%0A    %7D%0A
 %7D%0A

add ability to add a personal message to DiscreteOrderItemRequest (useful for gift cards)