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

package com.azure.resourcemanager.dataprotection.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;

/** Prefix criteria to be used to during restore. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType")
@JsonTypeName("ItemPathBasedRestoreCriteria")
@Fluent
public final class ItemPathBasedRestoreCriteria extends ItemLevelRestoreCriteria {
    /*
     * The path of the item to be restored. It could be the full path of the item or the path relative to the backup
     * item
     */
    @JsonProperty(value = "itemPath", required = true)
    private String itemPath;

    /*
     * Flag to specify if the path is relative to backup item or full path
     */
    @JsonProperty(value = "isPathRelativeToBackupItem", required = true)
    private boolean isPathRelativeToBackupItem;

    /*
     * The list of prefix strings to be used as filter criteria during restore. These are relative to the item path
     * specified.
     */
    @JsonProperty(value = "subItemPathPrefix")
    private List<String> subItemPathPrefix;

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

    /**
     * Get the itemPath property: The path of the item to be restored. It could be the full path of the item or the path
     * relative to the backup item.
     *
     * @return the itemPath value.
     */
    public String itemPath() {
        return this.itemPath;
    }

    /**
     * Set the itemPath property: The path of the item to be restored. It could be the full path of the item or the path
     * relative to the backup item.
     *
     * @param itemPath the itemPath value to set.
     * @return the ItemPathBasedRestoreCriteria object itself.
     */
    public ItemPathBasedRestoreCriteria withItemPath(String itemPath) {
        this.itemPath = itemPath;
        return this;
    }

    /**
     * Get the isPathRelativeToBackupItem property: Flag to specify if the path is relative to backup item or full path.
     *
     * @return the isPathRelativeToBackupItem value.
     */
    public boolean isPathRelativeToBackupItem() {
        return this.isPathRelativeToBackupItem;
    }

    /**
     * Set the isPathRelativeToBackupItem property: Flag to specify if the path is relative to backup item or full path.
     *
     * @param isPathRelativeToBackupItem the isPathRelativeToBackupItem value to set.
     * @return the ItemPathBasedRestoreCriteria object itself.
     */
    public ItemPathBasedRestoreCriteria withIsPathRelativeToBackupItem(boolean isPathRelativeToBackupItem) {
        this.isPathRelativeToBackupItem = isPathRelativeToBackupItem;
        return this;
    }

    /**
     * Get the subItemPathPrefix property: The list of prefix strings to be used as filter criteria during restore.
     * These are relative to the item path specified.
     *
     * @return the subItemPathPrefix value.
     */
    public List<String> subItemPathPrefix() {
        return this.subItemPathPrefix;
    }

    /**
     * Set the subItemPathPrefix property: The list of prefix strings to be used as filter criteria during restore.
     * These are relative to the item path specified.
     *
     * @param subItemPathPrefix the subItemPathPrefix value to set.
     * @return the ItemPathBasedRestoreCriteria object itself.
     */
    public ItemPathBasedRestoreCriteria withSubItemPathPrefix(List<String> subItemPathPrefix) {
        this.subItemPathPrefix = subItemPathPrefix;
        return this;
    }

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

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