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

package com.azure.resourcemanager.hybridconnectivity.models;

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

/** Represent ManageProxy Request object. */
@Fluent
public final class ManagedProxyRequest {
    /*
     * The name of the service.
     */
    @JsonProperty(value = "service", required = true)
    private String service;

    /*
     * The target host name.
     */
    @JsonProperty(value = "hostname")
    private String hostname;

    /*
     * The name of the service. It is an optional property, if not provided, service configuration tokens issue code
     * would be by passed.
     */
    @JsonProperty(value = "serviceName")
    private ServiceName serviceName;

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

    /**
     * Get the service property: The name of the service.
     *
     * @return the service value.
     */
    public String service() {
        return this.service;
    }

    /**
     * Set the service property: The name of the service.
     *
     * @param service the service value to set.
     * @return the ManagedProxyRequest object itself.
     */
    public ManagedProxyRequest withService(String service) {
        this.service = service;
        return this;
    }

    /**
     * Get the hostname property: The target host name.
     *
     * @return the hostname value.
     */
    public String hostname() {
        return this.hostname;
    }

    /**
     * Set the hostname property: The target host name.
     *
     * @param hostname the hostname value to set.
     * @return the ManagedProxyRequest object itself.
     */
    public ManagedProxyRequest withHostname(String hostname) {
        this.hostname = hostname;
        return this;
    }

    /**
     * Get the serviceName property: The name of the service. It is an optional property, if not provided, service
     * configuration tokens issue code would be by passed.
     *
     * @return the serviceName value.
     */
    public ServiceName serviceName() {
        return this.serviceName;
    }

    /**
     * Set the serviceName property: The name of the service. It is an optional property, if not provided, service
     * configuration tokens issue code would be by passed.
     *
     * @param serviceName the serviceName value to set.
     * @return the ManagedProxyRequest object itself.
     */
    public ManagedProxyRequest withServiceName(ServiceName serviceName) {
        this.serviceName = serviceName;
        return this;
    }

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

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