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

/** Definition of WidgetType. */
@Fluent
public final class WidgetType {
    /*
     * Name of the widget type.
     */
    @JsonProperty(value = "widgetTypeName", access = JsonProperty.Access.WRITE_ONLY)
    private String widgetTypeName;

    /*
     * Definition for widget type.
     */
    @JsonProperty(value = "definition", required = true)
    private String definition;

    /*
     * Description for widget type.
     */
    @JsonProperty(value = "description")
    private String description;

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

    /*
     * The image URL.
     */
    @JsonProperty(value = "imageUrl")
    private String imageUrl;

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

    /*
     * The widget version.
     */
    @JsonProperty(value = "widgetVersion")
    private String widgetVersion;

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

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

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

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

    /**
     * Get the definition property: Definition for widget type.
     *
     * @return the definition value.
     */
    public String definition() {
        return this.definition;
    }

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

    /**
     * Get the description property: Description for widget type.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Description for widget type.
     *
     * @param description the description value to set.
     * @return the WidgetType object itself.
     */
    public WidgetType withDescription(String description) {
        this.description = description;
        return this;
    }

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

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

    /**
     * Get the imageUrl property: The image URL.
     *
     * @return the imageUrl value.
     */
    public String imageUrl() {
        return this.imageUrl;
    }

    /**
     * Set the imageUrl property: The image URL.
     *
     * @param imageUrl the imageUrl value to set.
     * @return the WidgetType object itself.
     */
    public WidgetType withImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
        return this;
    }

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

    /**
     * Get the widgetVersion property: The widget version.
     *
     * @return the widgetVersion value.
     */
    public String widgetVersion() {
        return this.widgetVersion;
    }

    /**
     * Set the widgetVersion property: The widget version.
     *
     * @param widgetVersion the widgetVersion value to set.
     * @return the WidgetType object itself.
     */
    public WidgetType withWidgetVersion(String widgetVersion) {
        this.widgetVersion = widgetVersion;
        return this;
    }

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

    /**
     * Get the created property: Date time when widget type 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 WidgetType"));
        }
    }

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