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

package com.azure.resourcemanager.logic.models;

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

/** The swagger custom dynamic list. */
@Fluent
public final class SwaggerCustomDynamicList {
    /*
     * The operation id to fetch dynamic schema.
     */
    @JsonProperty(value = "operationId")
    private String operationId;

    /*
     * The built in operation.
     */
    @JsonProperty(value = "builtInOperation")
    private String builtInOperation;

    /*
     * The path to a response property (relative to the response object, not the response body) which contains an array
     * of dynamic value items.
     */
    @JsonProperty(value = "itemsPath")
    private String itemsPath;

    /*
     * The path to a property which defines the value which should be used.
     */
    @JsonProperty(value = "itemValuePath")
    private String itemValuePath;

    /*
     * The path to an item property which defines the display name of the item.
     */
    @JsonProperty(value = "itemTitlePath")
    private String itemTitlePath;

    /*
     * The parameters.
     */
    @JsonProperty(value = "parameters")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, SwaggerCustomDynamicProperties> parameters;

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

    /**
     * Get the operationId property: The operation id to fetch dynamic schema.
     *
     * @return the operationId value.
     */
    public String operationId() {
        return this.operationId;
    }

    /**
     * Set the operationId property: The operation id to fetch dynamic schema.
     *
     * @param operationId the operationId value to set.
     * @return the SwaggerCustomDynamicList object itself.
     */
    public SwaggerCustomDynamicList withOperationId(String operationId) {
        this.operationId = operationId;
        return this;
    }

    /**
     * Get the builtInOperation property: The built in operation.
     *
     * @return the builtInOperation value.
     */
    public String builtInOperation() {
        return this.builtInOperation;
    }

    /**
     * Set the builtInOperation property: The built in operation.
     *
     * @param builtInOperation the builtInOperation value to set.
     * @return the SwaggerCustomDynamicList object itself.
     */
    public SwaggerCustomDynamicList withBuiltInOperation(String builtInOperation) {
        this.builtInOperation = builtInOperation;
        return this;
    }

    /**
     * Get the itemsPath property: The path to a response property (relative to the response object, not the response
     * body) which contains an array of dynamic value items.
     *
     * @return the itemsPath value.
     */
    public String itemsPath() {
        return this.itemsPath;
    }

    /**
     * Set the itemsPath property: The path to a response property (relative to the response object, not the response
     * body) which contains an array of dynamic value items.
     *
     * @param itemsPath the itemsPath value to set.
     * @return the SwaggerCustomDynamicList object itself.
     */
    public SwaggerCustomDynamicList withItemsPath(String itemsPath) {
        this.itemsPath = itemsPath;
        return this;
    }

    /**
     * Get the itemValuePath property: The path to a property which defines the value which should be used.
     *
     * @return the itemValuePath value.
     */
    public String itemValuePath() {
        return this.itemValuePath;
    }

    /**
     * Set the itemValuePath property: The path to a property which defines the value which should be used.
     *
     * @param itemValuePath the itemValuePath value to set.
     * @return the SwaggerCustomDynamicList object itself.
     */
    public SwaggerCustomDynamicList withItemValuePath(String itemValuePath) {
        this.itemValuePath = itemValuePath;
        return this;
    }

    /**
     * Get the itemTitlePath property: The path to an item property which defines the display name of the item.
     *
     * @return the itemTitlePath value.
     */
    public String itemTitlePath() {
        return this.itemTitlePath;
    }

    /**
     * Set the itemTitlePath property: The path to an item property which defines the display name of the item.
     *
     * @param itemTitlePath the itemTitlePath value to set.
     * @return the SwaggerCustomDynamicList object itself.
     */
    public SwaggerCustomDynamicList withItemTitlePath(String itemTitlePath) {
        this.itemTitlePath = itemTitlePath;
        return this;
    }

    /**
     * Get the parameters property: The parameters.
     *
     * @return the parameters value.
     */
    public Map<String, SwaggerCustomDynamicProperties> parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: The parameters.
     *
     * @param parameters the parameters value to set.
     * @return the SwaggerCustomDynamicList object itself.
     */
    public SwaggerCustomDynamicList withParameters(Map<String, SwaggerCustomDynamicProperties> parameters) {
        this.parameters = parameters;
        return this;
    }

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