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

package com.azure.resourcemanager.appcontainers.models;

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

/** HTTPGet specifies the http request to perform. */
@Fluent
public final class ContainerAppProbeHttpGet {
    /*
     * Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.
     */
    @JsonProperty(value = "host")
    private String host;

    /*
     * Custom headers to set in the request. HTTP allows repeated headers.
     */
    @JsonProperty(value = "httpHeaders")
    private List<ContainerAppProbeHttpGetHttpHeadersItem> httpHeaders;

    /*
     * Path to access on the HTTP server.
     */
    @JsonProperty(value = "path")
    private String path;

    /*
     * Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an
     * IANA_SVC_NAME.
     */
    @JsonProperty(value = "port", required = true)
    private int port;

    /*
     * Scheme to use for connecting to the host. Defaults to HTTP.
     */
    @JsonProperty(value = "scheme")
    private Scheme scheme;

    /** Creates an instance of ContainerAppProbeHttpGet class. */
    public ContainerAppProbeHttpGet() {
    }

    /**
     * Get the host property: Host name to connect to, defaults to the pod IP. You probably want to set "Host" in
     * httpHeaders instead.
     *
     * @return the host value.
     */
    public String host() {
        return this.host;
    }

    /**
     * Set the host property: Host name to connect to, defaults to the pod IP. You probably want to set "Host" in
     * httpHeaders instead.
     *
     * @param host the host value to set.
     * @return the ContainerAppProbeHttpGet object itself.
     */
    public ContainerAppProbeHttpGet withHost(String host) {
        this.host = host;
        return this;
    }

    /**
     * Get the httpHeaders property: Custom headers to set in the request. HTTP allows repeated headers.
     *
     * @return the httpHeaders value.
     */
    public List<ContainerAppProbeHttpGetHttpHeadersItem> httpHeaders() {
        return this.httpHeaders;
    }

    /**
     * Set the httpHeaders property: Custom headers to set in the request. HTTP allows repeated headers.
     *
     * @param httpHeaders the httpHeaders value to set.
     * @return the ContainerAppProbeHttpGet object itself.
     */
    public ContainerAppProbeHttpGet withHttpHeaders(List<ContainerAppProbeHttpGetHttpHeadersItem> httpHeaders) {
        this.httpHeaders = httpHeaders;
        return this;
    }

    /**
     * Get the path property: Path to access on the HTTP server.
     *
     * @return the path value.
     */
    public String path() {
        return this.path;
    }

    /**
     * Set the path property: Path to access on the HTTP server.
     *
     * @param path the path value to set.
     * @return the ContainerAppProbeHttpGet object itself.
     */
    public ContainerAppProbeHttpGet withPath(String path) {
        this.path = path;
        return this;
    }

    /**
     * Get the port property: Name or number of the port to access on the container. Number must be in the range 1 to
     * 65535. Name must be an IANA_SVC_NAME.
     *
     * @return the port value.
     */
    public int port() {
        return this.port;
    }

    /**
     * Set the port property: Name or number of the port to access on the container. Number must be in the range 1 to
     * 65535. Name must be an IANA_SVC_NAME.
     *
     * @param port the port value to set.
     * @return the ContainerAppProbeHttpGet object itself.
     */
    public ContainerAppProbeHttpGet withPort(int port) {
        this.port = port;
        return this;
    }

    /**
     * Get the scheme property: Scheme to use for connecting to the host. Defaults to HTTP.
     *
     * @return the scheme value.
     */
    public Scheme scheme() {
        return this.scheme;
    }

    /**
     * Set the scheme property: Scheme to use for connecting to the host. Defaults to HTTP.
     *
     * @param scheme the scheme value to set.
     * @return the ContainerAppProbeHttpGet object itself.
     */
    public ContainerAppProbeHttpGet withScheme(Scheme scheme) {
        this.scheme = scheme;
        return this;
    }

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