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

package com.azure.resourcemanager.customerinsights.models;

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

/** The error management. */
@Fluent
public final class ConnectorMappingErrorManagement {
    /*
     * The type of error management to use for the mapping.
     */
    @JsonProperty(value = "errorManagementType", required = true)
    private ErrorManagementTypes errorManagementType;

    /*
     * The error limit allowed while importing data.
     */
    @JsonProperty(value = "errorLimit")
    private Integer errorLimit;

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

    /**
     * Get the errorManagementType property: The type of error management to use for the mapping.
     *
     * @return the errorManagementType value.
     */
    public ErrorManagementTypes errorManagementType() {
        return this.errorManagementType;
    }

    /**
     * Set the errorManagementType property: The type of error management to use for the mapping.
     *
     * @param errorManagementType the errorManagementType value to set.
     * @return the ConnectorMappingErrorManagement object itself.
     */
    public ConnectorMappingErrorManagement withErrorManagementType(ErrorManagementTypes errorManagementType) {
        this.errorManagementType = errorManagementType;
        return this;
    }

    /**
     * Get the errorLimit property: The error limit allowed while importing data.
     *
     * @return the errorLimit value.
     */
    public Integer errorLimit() {
        return this.errorLimit;
    }

    /**
     * Set the errorLimit property: The error limit allowed while importing data.
     *
     * @param errorLimit the errorLimit value to set.
     * @return the ConnectorMappingErrorManagement object itself.
     */
    public ConnectorMappingErrorManagement withErrorLimit(Integer errorLimit) {
        this.errorLimit = errorLimit;
        return this;
    }

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

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