// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** The view in Customer 360 web application. */
@Fluent
public final class View {
    /*
     * Name of the view.
     */
    @JsonProperty(value = "viewName", access = JsonProperty.Access.WRITE_ONLY)
    private String viewName;

    /*
     * the user ID.
     */
    @JsonProperty(value = "userId")
    private String userId;

    /*
     * the hub name.
     */
    @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
    private String tenantId;

    /*
     * Localized display name for the view.
     */
    @JsonProperty(value = "displayName")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> displayName;

    /*
     * View definition.
     */
    @JsonProperty(value = "definition", required = true)
    private String definition;

    /*
     * Date time when view was last modified.
     */
    @JsonProperty(value = "changed", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime changed;

    /*
     * Date time when view was created.
     */
    @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime created;

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

    /**
     * Get the viewName property: Name of the view.
     *
     * @return the viewName value.
     */
    public String viewName() {
        return this.viewName;
    }

    /**
     * Get the userId property: the user ID.
     *
     * @return the userId value.
     */
    public String userId() {
        return this.userId;
    }

    /**
     * Set the userId property: the user ID.
     *
     * @param userId the userId value to set.
     * @return the View object itself.
     */
    public View withUserId(String userId) {
        this.userId = userId;
        return this;
    }

    /**
     * Get the tenantId property: the hub name.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Get the displayName property: Localized display name for the view.
     *
     * @return the displayName value.
     */
    public Map<String, String> displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Localized display name for the view.
     *
     * @param displayName the displayName value to set.
     * @return the View object itself.
     */
    public View withDisplayName(Map<String, String> displayName) {
        this.displayName = displayName;
        return this;
    }

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

    /**
     * Set the definition property: View definition.
     *
     * @param definition the definition value to set.
     * @return the View object itself.
     */
    public View withDefinition(String definition) {
        this.definition = definition;
        return this;
    }

    /**
     * Get the changed property: Date time when view was last modified.
     *
     * @return the changed value.
     */
    public OffsetDateTime changed() {
        return this.changed;
    }

    /**
     * Get the created property: Date time when view was created.
     *
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.created;
    }

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

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