/*
 * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file 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 com.amazonaws.services.apigateway.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * <p>
 * A documentation part for a targeted API entity.
 * </p>
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DocumentationPart implements Serializable, Cloneable, StructuredPojo {

    /**
     * <p>
     * The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is created.
     * </p>
     */
    private String id;
    /**
     * <p>
     * The location of the API entity to which the documentation applies. Valid fields depend on the targeted API entity
     * type. All the valid location fields are not required. If not explicitly specified, a valid location field is
     * treated as a wildcard and associated documentation content may be inherited by matching entities, unless
     * overridden.
     * </p>
     */
    private DocumentationPartLocation location;
    /**
     * <p>
     * A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a
     * JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     * documentation-related fields from the properties map are exported and, hence, published as part of the API entity
     * definitions, while the original documentation parts are exported in a OpenAPI extension of
     * <code>x-amazon-apigateway-documentation</code>.
     * </p>
     */
    private String properties;

    /**
     * <p>
     * The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is created.
     * </p>
     * 
     * @param id
     *        The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is
     *        created.
     */

    public void setId(String id) {
        this.id = id;
    }

    /**
     * <p>
     * The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is created.
     * </p>
     * 
     * @return The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is
     *         created.
     */

    public String getId() {
        return this.id;
    }

    /**
     * <p>
     * The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is created.
     * </p>
     * 
     * @param id
     *        The DocumentationPart identifier, generated by API Gateway when the <code>DocumentationPart</code> is
     *        created.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DocumentationPart withId(String id) {
        setId(id);
        return this;
    }

    /**
     * <p>
     * The location of the API entity to which the documentation applies. Valid fields depend on the targeted API entity
     * type. All the valid location fields are not required. If not explicitly specified, a valid location field is
     * treated as a wildcard and associated documentation content may be inherited by matching entities, unless
     * overridden.
     * </p>
     * 
     * @param location
     *        The location of the API entity to which the documentation applies. Valid fields depend on the targeted API
     *        entity type. All the valid location fields are not required. If not explicitly specified, a valid location
     *        field is treated as a wildcard and associated documentation content may be inherited by matching entities,
     *        unless overridden.
     */

    public void setLocation(DocumentationPartLocation location) {
        this.location = location;
    }

    /**
     * <p>
     * The location of the API entity to which the documentation applies. Valid fields depend on the targeted API entity
     * type. All the valid location fields are not required. If not explicitly specified, a valid location field is
     * treated as a wildcard and associated documentation content may be inherited by matching entities, unless
     * overridden.
     * </p>
     * 
     * @return The location of the API entity to which the documentation applies. Valid fields depend on the targeted
     *         API entity type. All the valid location fields are not required. If not explicitly specified, a valid
     *         location field is treated as a wildcard and associated documentation content may be inherited by matching
     *         entities, unless overridden.
     */

    public DocumentationPartLocation getLocation() {
        return this.location;
    }

    /**
     * <p>
     * The location of the API entity to which the documentation applies. Valid fields depend on the targeted API entity
     * type. All the valid location fields are not required. If not explicitly specified, a valid location field is
     * treated as a wildcard and associated documentation content may be inherited by matching entities, unless
     * overridden.
     * </p>
     * 
     * @param location
     *        The location of the API entity to which the documentation applies. Valid fields depend on the targeted API
     *        entity type. All the valid location fields are not required. If not explicitly specified, a valid location
     *        field is treated as a wildcard and associated documentation content may be inherited by matching entities,
     *        unless overridden.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DocumentationPart withLocation(DocumentationPartLocation location) {
        setLocation(location);
        return this;
    }

    /**
     * <p>
     * A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a
     * JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     * documentation-related fields from the properties map are exported and, hence, published as part of the API entity
     * definitions, while the original documentation parts are exported in a OpenAPI extension of
     * <code>x-amazon-apigateway-documentation</code>.
     * </p>
     * 
     * @param properties
     *        A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded
     *        as a JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     *        documentation-related fields from the properties map are exported and, hence, published as part of the API
     *        entity definitions, while the original documentation parts are exported in a OpenAPI extension of
     *        <code>x-amazon-apigateway-documentation</code>.
     */

    public void setProperties(String properties) {
        this.properties = properties;
    }

    /**
     * <p>
     * A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a
     * JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     * documentation-related fields from the properties map are exported and, hence, published as part of the API entity
     * definitions, while the original documentation parts are exported in a OpenAPI extension of
     * <code>x-amazon-apigateway-documentation</code>.
     * </p>
     * 
     * @return A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded
     *         as a JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     *         documentation-related fields from the properties map are exported and, hence, published as part of the
     *         API entity definitions, while the original documentation parts are exported in a OpenAPI extension of
     *         <code>x-amazon-apigateway-documentation</code>.
     */

    public String getProperties() {
        return this.properties;
    }

    /**
     * <p>
     * A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a
     * JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     * documentation-related fields from the properties map are exported and, hence, published as part of the API entity
     * definitions, while the original documentation parts are exported in a OpenAPI extension of
     * <code>x-amazon-apigateway-documentation</code>.
     * </p>
     * 
     * @param properties
     *        A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded
     *        as a JSON string, e.g., <code>"{ \"description\": \"The API does ...\" }"</code>. Only OpenAPI-compliant
     *        documentation-related fields from the properties map are exported and, hence, published as part of the API
     *        entity definitions, while the original documentation parts are exported in a OpenAPI extension of
     *        <code>x-amazon-apigateway-documentation</code>.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DocumentationPart withProperties(String properties) {
        setProperties(properties);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getId() != null)
            sb.append("Id: ").append(getId()).append(",");
        if (getLocation() != null)
            sb.append("Location: ").append(getLocation()).append(",");
        if (getProperties() != null)
            sb.append("Properties: ").append(getProperties());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DocumentationPart == false)
            return false;
        DocumentationPart other = (DocumentationPart) obj;
        if (other.getId() == null ^ this.getId() == null)
            return false;
        if (other.getId() != null && other.getId().equals(this.getId()) == false)
            return false;
        if (other.getLocation() == null ^ this.getLocation() == null)
            return false;
        if (other.getLocation() != null && other.getLocation().equals(this.getLocation()) == false)
            return false;
        if (other.getProperties() == null ^ this.getProperties() == null)
            return false;
        if (other.getProperties() != null && other.getProperties().equals(this.getProperties()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
        hashCode = prime * hashCode + ((getLocation() == null) ? 0 : getLocation().hashCode());
        hashCode = prime * hashCode + ((getProperties() == null) ? 0 : getProperties().hashCode());
        return hashCode;
    }

    @Override
    public DocumentationPart clone() {
        try {
            return (DocumentationPart) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.apigateway.model.transform.DocumentationPartMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}
