// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.apimanagement.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Operation response details. */
@Fluent
public final class ResponseContract {
    /*
     * Operation response HTTP status code.
     */
    @JsonProperty(value = "statusCode", required = true)
    private int statusCode;

    /*
     * Operation response description.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * Collection of operation response representations.
     */
    @JsonProperty(value = "representations")
    private List<RepresentationContract> representations;

    /*
     * Collection of operation response headers.
     */
    @JsonProperty(value = "headers")
    private List<ParameterContract> headers;

    /**
     * Get the statusCode property: Operation response HTTP status code.
     *
     * @return the statusCode value.
     */
    public int statusCode() {
        return this.statusCode;
    }

    /**
     * Set the statusCode property: Operation response HTTP status code.
     *
     * @param statusCode the statusCode value to set.
     * @return the ResponseContract object itself.
     */
    public ResponseContract withStatusCode(int statusCode) {
        this.statusCode = statusCode;
        return this;
    }

    /**
     * Get the description property: Operation response description.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Operation response description.
     *
     * @param description the description value to set.
     * @return the ResponseContract object itself.
     */
    public ResponseContract withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the representations property: Collection of operation response representations.
     *
     * @return the representations value.
     */
    public List<RepresentationContract> representations() {
        return this.representations;
    }

    /**
     * Set the representations property: Collection of operation response representations.
     *
     * @param representations the representations value to set.
     * @return the ResponseContract object itself.
     */
    public ResponseContract withRepresentations(List<RepresentationContract> representations) {
        this.representations = representations;
        return this;
    }

    /**
     * Get the headers property: Collection of operation response headers.
     *
     * @return the headers value.
     */
    public List<ParameterContract> headers() {
        return this.headers;
    }

    /**
     * Set the headers property: Collection of operation response headers.
     *
     * @param headers the headers value to set.
     * @return the ResponseContract object itself.
     */
    public ResponseContract withHeaders(List<ParameterContract> headers) {
        this.headers = headers;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (representations() != null) {
            representations().forEach(e -> e.validate());
        }
        if (headers() != null) {
            headers().forEach(e -> e.validate());
        }
    }
}
