// 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.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** Describes an entity. */
@Fluent
public class EntityTypeDefinition extends MetadataDefinitionBase {
    /*
     * The api entity set name. This becomes the odata entity set name for the entity Type being referred in this
     * object.
     */
    @JsonProperty(value = "apiEntitySetName")
    private String apiEntitySetName;

    /*
     * Type of entity.
     */
    @JsonProperty(value = "entityType")
    private EntityTypes entityType;

    /*
     * The properties of the Profile.
     */
    @JsonProperty(value = "fields")
    private List<PropertyDefinition> fields;

    /*
     * The instance count.
     */
    @JsonProperty(value = "instancesCount")
    private Integer instancesCount;

    /*
     * The last changed time for the type definition.
     */
    @JsonProperty(value = "lastChangedUtc", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastChangedUtc;

    /*
     * Provisioning state.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningStates provisioningState;

    /*
     * The schema org link. This helps ACI identify and suggest semantic models.
     */
    @JsonProperty(value = "schemaItemTypeLink")
    private String schemaItemTypeLink;

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

    /*
     * The timestamp property name. Represents the time when the interaction or profile update happened.
     */
    @JsonProperty(value = "timestampFieldName")
    private String timestampFieldName;

    /*
     * The name of the entity.
     */
    @JsonProperty(value = "typeName")
    private String typeName;

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

    /**
     * Get the apiEntitySetName property: The api entity set name. This becomes the odata entity set name for the entity
     * Type being referred in this object.
     *
     * @return the apiEntitySetName value.
     */
    public String apiEntitySetName() {
        return this.apiEntitySetName;
    }

    /**
     * Set the apiEntitySetName property: The api entity set name. This becomes the odata entity set name for the entity
     * Type being referred in this object.
     *
     * @param apiEntitySetName the apiEntitySetName value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withApiEntitySetName(String apiEntitySetName) {
        this.apiEntitySetName = apiEntitySetName;
        return this;
    }

    /**
     * Get the entityType property: Type of entity.
     *
     * @return the entityType value.
     */
    public EntityTypes entityType() {
        return this.entityType;
    }

    /**
     * Set the entityType property: Type of entity.
     *
     * @param entityType the entityType value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withEntityType(EntityTypes entityType) {
        this.entityType = entityType;
        return this;
    }

    /**
     * Get the fields property: The properties of the Profile.
     *
     * @return the fields value.
     */
    public List<PropertyDefinition> fields() {
        return this.fields;
    }

    /**
     * Set the fields property: The properties of the Profile.
     *
     * @param fields the fields value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withFields(List<PropertyDefinition> fields) {
        this.fields = fields;
        return this;
    }

    /**
     * Get the instancesCount property: The instance count.
     *
     * @return the instancesCount value.
     */
    public Integer instancesCount() {
        return this.instancesCount;
    }

    /**
     * Set the instancesCount property: The instance count.
     *
     * @param instancesCount the instancesCount value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withInstancesCount(Integer instancesCount) {
        this.instancesCount = instancesCount;
        return this;
    }

    /**
     * Get the lastChangedUtc property: The last changed time for the type definition.
     *
     * @return the lastChangedUtc value.
     */
    public OffsetDateTime lastChangedUtc() {
        return this.lastChangedUtc;
    }

    /**
     * Get the provisioningState property: Provisioning state.
     *
     * @return the provisioningState value.
     */
    public ProvisioningStates provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the schemaItemTypeLink property: The schema org link. This helps ACI identify and suggest semantic models.
     *
     * @return the schemaItemTypeLink value.
     */
    public String schemaItemTypeLink() {
        return this.schemaItemTypeLink;
    }

    /**
     * Set the schemaItemTypeLink property: The schema org link. This helps ACI identify and suggest semantic models.
     *
     * @param schemaItemTypeLink the schemaItemTypeLink value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withSchemaItemTypeLink(String schemaItemTypeLink) {
        this.schemaItemTypeLink = schemaItemTypeLink;
        return this;
    }

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

    /**
     * Get the timestampFieldName property: The timestamp property name. Represents the time when the interaction or
     * profile update happened.
     *
     * @return the timestampFieldName value.
     */
    public String timestampFieldName() {
        return this.timestampFieldName;
    }

    /**
     * Set the timestampFieldName property: The timestamp property name. Represents the time when the interaction or
     * profile update happened.
     *
     * @param timestampFieldName the timestampFieldName value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withTimestampFieldName(String timestampFieldName) {
        this.timestampFieldName = timestampFieldName;
        return this;
    }

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

    /**
     * Set the typeName property: The name of the entity.
     *
     * @param typeName the typeName value to set.
     * @return the EntityTypeDefinition object itself.
     */
    public EntityTypeDefinition withTypeName(String typeName) {
        this.typeName = typeName;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withAttributes(Map<String, List<String>> attributes) {
        super.withAttributes(attributes);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withDescription(Map<String, String> description) {
        super.withDescription(description);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withDisplayName(Map<String, String> displayName) {
        super.withDisplayName(displayName);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withLocalizedAttributes(Map<String, Map<String, String>> localizedAttributes) {
        super.withLocalizedAttributes(localizedAttributes);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withSmallImage(String smallImage) {
        super.withSmallImage(smallImage);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withMediumImage(String mediumImage) {
        super.withMediumImage(mediumImage);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EntityTypeDefinition withLargeImage(String largeImage) {
        super.withLargeImage(largeImage);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (fields() != null) {
            fields().forEach(e -> e.validate());
        }
    }
}
