package com.amazonaws.a2s.model;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 <p>Java class for SimilarityLookupRequest complex type.
 
 <p>The following schema fragment specifies the expected content contained within this class.
 
 <pre>
 * &lt;complexType name="SimilarityLookupRequest">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="Condition" type="{http://webservices.amazon.com/AWSECommerceService/2007-10-29}Condition" minOccurs="0"/>
 *         &lt;element name="DeliveryMethod" type="{http://webservices.amazon.com/AWSECommerceService/2007-10-29}DeliveryMethod" minOccurs="0"/>
 *         &lt;element name="ItemId" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="ISPUPostalCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="MerchantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="ResponseGroup" maxOccurs="unbounded" minOccurs="0">
 *           &lt;simpleType>
 *             &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *               &lt;enumeration value="Request"/>
 *               &lt;enumeration value="Small"/>
 *               &lt;enumeration value="Accessories"/>
 *               &lt;enumeration value="BrowseNodes"/>
 *               &lt;enumeration value="EditorialReview"/>
 *               &lt;enumeration value="Images"/>
 *               &lt;enumeration value="Large"/>
 *               &lt;enumeration value="ItemAttributes"/>
 *               &lt;enumeration value="ItemIds"/>
 *               &lt;enumeration value="ListmaniaLists"/>
 *               &lt;enumeration value="Medium"/>
 *               &lt;enumeration value="Offers"/>
 *               &lt;enumeration value="OfferSummary"/>
 *               &lt;enumeration value="PromotionDetails"/>
 *               &lt;enumeration value="PromotionSummary"/>
 *               &lt;enumeration value="Reviews"/>
 *               &lt;enumeration value="SalesRank"/>
 *               &lt;enumeration value="Similarities"/>
 *               &lt;enumeration value="Tracks"/>
 *               &lt;enumeration value="VariationMinimum"/>
 *               &lt;enumeration value="Variations"/>
 *               &lt;enumeration value="VariationSummary"/>
 *             &lt;/restriction>
 *           &lt;/simpleType>
 *         &lt;/element>
 *         &lt;element name="ReviewSort" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="SimilarityType" minOccurs="0">
 *           &lt;simpleType>
 *             &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *               &lt;enumeration value="Intersection"/>
 *               &lt;enumeration value="Random"/>
 *             &lt;/restriction>
 *           &lt;/simpleType>
 *         &lt;/element>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 </pre>
 * Generated by AWS Code Generator
 <p/>
 * Thu Jan 10 05:27:59 PST 2008
 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SimilarityLookupRequest", propOrder = {
    "condition",
    "deliveryMethod",
    "itemId",
    "ispuPostalCode",
    "merchantId",
    "responseGroup",
    "reviewSort",
    "similarityType"
})
public class SimilarityLookupRequest {

    @XmlElement(name = "Condition")
    protected Condition condition;
    @XmlElement(name = "DeliveryMethod")
    protected DeliveryMethod deliveryMethod;
    @XmlElement(name = "ItemId")
    protected List<String> itemId;
    @XmlElement(name = "ISPUPostalCode")
    protected String ispuPostalCode;
    @XmlElement(name = "MerchantId")
    protected String merchantId;
    @XmlElement(name = "ResponseGroup")
    protected List<String> responseGroup;
    @XmlElement(name = "ReviewSort")
    protected String reviewSort;
    @XmlElement(name = "SimilarityType")
    protected String similarityType;

    /**
     * Gets the value of the condition property.
     
     @return
     *     possible object is
     *     {@link Condition }
     *     
     */
    public Condition getCondition() {
        return condition;
    }

    /**
     * Sets the value of the condition property.
     
     @param value
     *     allowed object is
     *     {@link Condition }
     *     
     */
    public void setCondition(Condition value) {
        this.condition = value;
    }

    public boolean isSetCondition() {
        return (this.condition!= null);
    }

    /**
     * Gets the value of the deliveryMethod property.
     
     @return
     *     possible object is
     *     {@link DeliveryMethod }
     *     
     */
    public DeliveryMethod getDeliveryMethod() {
        return deliveryMethod;
    }

    /**
     * Sets the value of the deliveryMethod property.
     
     @param value
     *     allowed object is
     *     {@link DeliveryMethod }
     *     
     */
    public void setDeliveryMethod(DeliveryMethod value) {
        this.deliveryMethod = value;
    }

    public boolean isSetDeliveryMethod() {
        return (this.deliveryMethod!= null);
    }

    /**
     * Gets the value of the itemId property.
     
     <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the itemId property.
     
     <p>
     * For example, to add a new item, do as follows:
     <pre>
     *    getItemId().add(newItem);
     </pre>
     
     
     <p>
     * Objects of the following type(s) are allowed in the list
     {@link String }
     
     
     */
    public List<String> getItemId() {
        if (itemId == null) {
            itemId = new ArrayList<String>();
        }
        return this.itemId;
    }

    public boolean isSetItemId() {
        return ((this.itemId!= null)&&(!this.itemId.isEmpty()));
    }

    public void unsetItemId() {
        this.itemId = null;
    }

    /**
     * Gets the value of the ispuPostalCode property.
     
     @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getISPUPostalCode() {
        return ispuPostalCode;
    }

    /**
     * Sets the value of the ispuPostalCode property.
     
     @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setISPUPostalCode(String value) {
        this.ispuPostalCode = value;
    }

    public boolean isSetISPUPostalCode() {
        return (this.ispuPostalCode!= null);
    }

    /**
     * Gets the value of the merchantId property.
     
     @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getMerchantId() {
        return merchantId;
    }

    /**
     * Sets the value of the merchantId property.
     
     @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setMerchantId(String value) {
        this.merchantId = value;
    }

    public boolean isSetMerchantId() {
        return (this.merchantId!= null);
    }

    /**
     * Gets the value of the responseGroup property.
     
     <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the responseGroup property.
     
     <p>
     * For example, to add a new item, do as follows:
     <pre>
     *    getResponseGroup().add(newItem);
     </pre>
     
     
     <p>
     * Objects of the following type(s) are allowed in the list
     {@link String }
     
     
     */
    public List<String> getResponseGroup() {
        if (responseGroup == null) {
            responseGroup = new ArrayList<String>();
        }
        return this.responseGroup;
    }

    public boolean isSetResponseGroup() {
        return ((this.responseGroup!= null)&&(!this.responseGroup.isEmpty()));
    }

    public void unsetResponseGroup() {
        this.responseGroup = null;
    }

    /**
     * Gets the value of the reviewSort property.
     
     @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getReviewSort() {
        return reviewSort;
    }

    /**
     * Sets the value of the reviewSort property.
     
     @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setReviewSort(String value) {
        this.reviewSort = value;
    }

    public boolean isSetReviewSort() {
        return (this.reviewSort!= null);
    }

    /**
     * Gets the value of the similarityType property.
     
     @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getSimilarityType() {
        return similarityType;
    }

    /**
     * Sets the value of the similarityType property.
     
     @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setSimilarityType(String value) {
        this.similarityType = value;
    }

    public boolean isSetSimilarityType() {
        return (this.similarityType!= null);
    }

    /**
     * Sets the value of the Condition property.
     
     @param value
     @return
     *     this instance
     */
    public SimilarityLookupRequest withCondition(Condition value) {
        setCondition(value);
        return this;
    }

    /**
     * Sets the value of the DeliveryMethod property.
     
     @param value
     @return
     *     this instance
     */
    public SimilarityLookupRequest withDeliveryMethod(DeliveryMethod value) {
        setDeliveryMethod(value);
        return this;
    }

    /**
     * Sets the value of the ItemId property.
     
     @param values
     @return
     *     this instance
     */
    public SimilarityLookupRequest withItemId(String... values) {
        for (String value: values) {
            getItemId().add(value);
        }
        return this;
    }

    /**
     * Sets the value of the ISPUPostalCode property.
     
     @param value
     @return
     *     this instance
     */
    public SimilarityLookupRequest withISPUPostalCode(String value) {
        setISPUPostalCode(value);
        return this;
    }

    /**
     * Sets the value of the MerchantId property.
     
     @param value
     @return
     *     this instance
     */
    public SimilarityLookupRequest withMerchantId(String value) {
        setMerchantId(value);
        return this;
    }

    /**
     * Sets the value of the ResponseGroup property.
     
     @param values
     @return
     *     this instance
     */
    public SimilarityLookupRequest withResponseGroup(String... values) {
        for (String value: values) {
            getResponseGroup().add(value);
        }
        return this;
    }

    /**
     * Sets the value of the ReviewSort property.
     
     @param value
     @return
     *     this instance
     */
    public SimilarityLookupRequest withReviewSort(String value) {
        setReviewSort(value);
        return this;
    }

    /**
     * Sets the value of the SimilarityType property.
     
     @param value
     @return
     *     this instance
     */
    public SimilarityLookupRequest withSimilarityType(String value) {
        setSimilarityType(value);
        return this;
    }

    /**
     * Sets the value of the itemId property.
     
     @param itemId
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setItemId(List<String> itemId) {
        this.itemId = itemId;
    }

    /**
     * Sets the value of the responseGroup property.
     
     @param responseGroup
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setResponseGroup(List<String> responseGroup) {
        this.responseGroup = responseGroup;
    }
    

    /**
     
     * XML fragment representation of this object
     
     @return XML fragment for this object. Name for outer
     * tag expected to be set by calling method. This fragment
     * returns inner properties representation only
     */
    protected String toXMLFragment() {
        StringBuffer xml = new StringBuffer();
        if (isSetCondition()) {
            xml.append("<Condition>");
            xml.append(getCondition().value());
            xml.append("</Condition>");
        }
        if (isSetDeliveryMethod()) {
            xml.append("<DeliveryMethod>");
            xml.append(getDeliveryMethod().value());
            xml.append("</DeliveryMethod>");
        }
        java.util.List<String> itemIdList  =  getItemId();
        for (String itemId : itemIdList) { 
            xml.append("<ItemId>");
            xml.append(escapeXML(itemId));
            xml.append("</ItemId>");
        }  
        if (isSetISPUPostalCode()) {
            xml.append("<ISPUPostalCode>");
            xml.append(escapeXML(getISPUPostalCode()));
            xml.append("</ISPUPostalCode>");
        }
        if (isSetMerchantId()) {
            xml.append("<MerchantId>");
            xml.append(escapeXML(getMerchantId()));
            xml.append("</MerchantId>");
        }
        java.util.List<String> responseGroupList  =  getResponseGroup();
        for (String responseGroup : responseGroupList) { 
            xml.append("<ResponseGroup>");
            xml.append(responseGroup + "");
            xml.append("</ResponseGroup>");
        }  
        if (isSetReviewSort()) {
            xml.append("<ReviewSort>");
            xml.append(escapeXML(getReviewSort()));
            xml.append("</ReviewSort>");
        }
        if (isSetSimilarityType()) {
            xml.append("<SimilarityType>");
            xml.append(getSimilarityType() "");
            xml.append("</SimilarityType>");
        }
        return xml.toString();
    }

    /**
     
     * Escape XML special characters
     */
    private String escapeXML(String string) {
        StringBuffer sb = new StringBuffer();
        int length = string.length();
        for (int i = 0; i < length; ++i) {
            char c = string.charAt(i);
            switch (c) {
            case '&':
                sb.append("&amp;");
                break;
            case '<':
                sb.append("&lt;");
                break;
            case '>':
                sb.append("&gt;");
                break;
            case '\'':
                sb.append("&#039;");
                break;
            case '"':
                sb.append("&quot;");
                break;
            default:
                sb.append(c);
            }
        }
        return sb.toString();
    }


}