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

package com.azure.resourcemanager.providerhub.models;

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

/** The TypedErrorInfo model. */
@Fluent
public final class TypedErrorInfo {
    /*
     * The type property.
     */
    @JsonProperty(value = "type", required = true)
    private String type;

    /*
     * Any object
     */
    @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY)
    private Object info;

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

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

    /**
     * Set the type property: The type property.
     *
     * @param type the type value to set.
     * @return the TypedErrorInfo object itself.
     */
    public TypedErrorInfo withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the info property: Any object.
     *
     * @return the info value.
     */
    public Object info() {
        return this.info;
    }

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

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