// 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;

/** Map a field of profile to its corresponding StrongId in Related Profile. */
@Fluent
public final class RelationshipTypeFieldMapping {
    /*
     * Specifies the fieldName in profile.
     */
    @JsonProperty(value = "profileFieldName", required = true)
    private String profileFieldName;

    /*
     * Specifies the KeyProperty (from StrongId) of the related profile.
     */
    @JsonProperty(value = "relatedProfileKeyProperty", required = true)
    private String relatedProfileKeyProperty;

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

    /**
     * Get the profileFieldName property: Specifies the fieldName in profile.
     *
     * @return the profileFieldName value.
     */
    public String profileFieldName() {
        return this.profileFieldName;
    }

    /**
     * Set the profileFieldName property: Specifies the fieldName in profile.
     *
     * @param profileFieldName the profileFieldName value to set.
     * @return the RelationshipTypeFieldMapping object itself.
     */
    public RelationshipTypeFieldMapping withProfileFieldName(String profileFieldName) {
        this.profileFieldName = profileFieldName;
        return this;
    }

    /**
     * Get the relatedProfileKeyProperty property: Specifies the KeyProperty (from StrongId) of the related profile.
     *
     * @return the relatedProfileKeyProperty value.
     */
    public String relatedProfileKeyProperty() {
        return this.relatedProfileKeyProperty;
    }

    /**
     * Set the relatedProfileKeyProperty property: Specifies the KeyProperty (from StrongId) of the related profile.
     *
     * @param relatedProfileKeyProperty the relatedProfileKeyProperty value to set.
     * @return the RelationshipTypeFieldMapping object itself.
     */
    public RelationshipTypeFieldMapping withRelatedProfileKeyProperty(String relatedProfileKeyProperty) {
        this.relatedProfileKeyProperty = relatedProfileKeyProperty;
        return this;
    }

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

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