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

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The Route model. */
@Fluent
public final class Route {
    /*
     * [Required] The path for the route.
     */
    @JsonProperty(value = "path", required = true)
    private String path;

    /*
     * [Required] The port for the route.
     */
    @JsonProperty(value = "port", required = true)
    private int port;

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

    /**
     * Get the path property: [Required] The path for the route.
     *
     * @return the path value.
     */
    public String path() {
        return this.path;
    }

    /**
     * Set the path property: [Required] The path for the route.
     *
     * @param path the path value to set.
     * @return the Route object itself.
     */
    public Route withPath(String path) {
        this.path = path;
        return this;
    }

    /**
     * Get the port property: [Required] The port for the route.
     *
     * @return the port value.
     */
    public int port() {
        return this.port;
    }

    /**
     * Set the port property: [Required] The port for the route.
     *
     * @param port the port value to set.
     * @return the Route object itself.
     */
    public Route withPort(int port) {
        this.port = port;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (path() == null) {
            throw LOGGER
                .logExceptionAsError(new IllegalArgumentException("Missing required property path in model Route"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(Route.class);
}
