<%#
 Copyright 2013-2023 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      https://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
package <%= packageName %>.domain;
<%_
const manyListName = ormTool === 'hibernate' ? 'Set' : 'List';
const manyListType = ormTool === 'hibernate' ? 'LinkedHashSet' : 'ArrayList';
_%>
<%_ if (ormTool === 'mybatis') { _%>
import com.baomidou.mybatisplus.annotation.*;
import com.diboot.core.binding.annotation.BindEntityList;
<%_ } _%>
import <%= packageName %>.config.Constants;

<%_ if (databaseTypeCouchbase) { _%>
import org.springframework.data.couchbase.core.mapping.Field;
<%_ } _%>
<%_ if (!reactive && databaseTypeCassandra) { _%>
import com.datastax.oss.driver.api.mapper.annotations.CqlName;
import com.datastax.oss.driver.api.mapper.annotations.Entity;
import com.datastax.oss.driver.api.mapper.annotations.NamingStrategy;
import com.datastax.oss.driver.api.mapper.annotations.PartitionKey;
import com.datastax.oss.driver.api.mapper.entity.naming.NamingConvention;
<%_ } _%>
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.StringUtils;
<%_ if (databaseTypeSql && !reactive && ormTool === 'hibernate') { _%>
import org.hibernate.annotations.BatchSize;
<%_ } _%>
<%_ if (enableHibernateCache && ormTool === 'hibernate') { _%>
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
  <%_ if (requiresPersistableImplementation) { _%>
import org.springframework.data.domain.Persistable;
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Field;
<%_ } _%> <%_ if (databaseTypeNeo4j) { _%>
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import org.springframework.data.neo4j.core.schema.Relationship;
import org.springframework.data.neo4j.core.support.UUIDStringGenerator;
<%_ } _%> <%_ if (reactive && databaseTypeCassandra) { _%>
import org.springframework.data.cassandra.core.mapping.Column;
import org.springframework.data.cassandra.core.mapping.PrimaryKey;
import org.springframework.data.cassandra.core.mapping.Table;
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
import org.springframework.data.annotation.Id;
import org.springframework.data.couchbase.core.mapping.Document;
import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
import org.springframework.data.couchbase.core.mapping.id.IdAttribute;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.couchbase.repository.Collection;
import static <%= packageName %>.domain.User.TYPE_NAME;
<%_ } _%>
<%_ if (searchEngineElasticsearch) { _%>
import org.springframework.data.elasticsearch.annotations.FieldType;
<%_ } _%>

<%_ if (databaseTypeSql && !reactive && ormTool === 'hibernate') { _%>
import <%= javaVersion === '17' ? 'jakarta' : 'javax'%>.persistence.*;
<%_ } _%>
import <%= javaVersion === '17' ? 'jakarta' : 'javax'%>.validation.constraints.Email;
import <%= javaVersion === '17' ? 'jakarta' : 'javax'%>.validation.constraints.NotNull;
import <%= javaVersion === '17' ? 'jakarta' : 'javax'%>.validation.constraints.Pattern;
import <%= javaVersion === '17' ? 'jakarta' : 'javax'%>.validation.constraints.Size;
import java.io.Serializable;
<%_ if (!authenticationTypeOauth2) { _%>
import java.time.Instant;
<%_ } _%>
import java.time.ZonedDateTime;
<%_ if (softDelete) { _%>
import java.time.LocalDate;
<%_ } _%>
import java.util.*;
<%_ if (softDelete && ormTool === 'hibernate') { _%>
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
<%_ } _%>

<%_ if (databaseTypeCouchbase) { _%>
import static <%= packageName %>.config.Constants.ID_DELIMITER;
import static org.springframework.data.couchbase.core.mapping.id.GenerationStrategy.USE_ATTRIBUTES;

<%_ } _%>
/**
 * A user.
 */
<%_ if (databaseTypeSql) { _%>
  <%_ if (!reactive && ormTool === 'hibernate') { _%>
@Entity
  <%_ } _%>
  <%_ if (ormTool === 'hibernate') { _%>
@Table(<% if (!reactive) { %>name = <% } %>"<%= user.entityTableName %>")
  <%_ } else { _%>
@TableName(value = "<%= user.entityTableName %>")
  <%_ } _%>
<%_ } _%>
<%_ if (enableHibernateCache && ormTool === 'hibernate') { _%>
@Cache(usage = CacheConcurrencyStrategy.<% if (!cacheProviderInfinispan) { %>NONSTRICT_<% } %>READ_WRITE)
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
@org.springframework.data.mongodb.core.mapping.Document(collection = "<%= jhiTablePrefix %>_user")
<%_ } _%>
<%_ if (databaseTypeNeo4j) { _%>
@Node("<%= user.entityTableName %>")
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
@Document
@TypeAlias(TYPE_NAME)
@Collection(TYPE_NAME)
<%_ } _%>
<%_ if (databaseTypeCassandra) { _%>
  <%_ if (reactive) { _%>
@Table("user")
  <%_ } else { _%>
@Entity
@NamingStrategy(convention = NamingConvention.SNAKE_CASE_INSENSITIVE)
  <%_ } _%>
<%_ } _%>
<%_ if (searchEngineElasticsearch) { _%>
@org.springframework.data.elasticsearch.annotations.Document(indexName = "user")
<%_ } _%>
public class <%= user.persistClass %><% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { %> extends AbstractAuditingEntity<<%= user.primaryKey.type %>, <%= user.persistClass %>><% } %> implements Serializable<% if (databaseTypeSql && reactive && requiresPersistableImplementation) { %>, Persistable<<% if (user.primaryKey.hasUUID) { %>UUID<% } else { %>String<% } %>><% } %> {

    private static final long serialVersionUID = 1L;

<%_ if (databaseTypeCouchbase) { _%>
    public static final String TYPE_NAME = "user";
<%_ } _%>

<%_ if (databaseTypeSql) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Id
  <%_ if (!reactive) { _%>
    <%_ if (user.primaryKey.fields[0].jpaGeneratedValue === 'identity') { _%>
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    <%_ } else if (user.primaryKey.fields[0].jpaGeneratedValue === 'sequence') { _%>
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
    @SequenceGenerator(name = "sequenceGenerator"<% if (user.primaryKey.fields[0].liquibaseCustomSequenceGenerator) { %>, sequenceName = "<%- user.primaryKey.fields[0].jpaSequenceGeneratorName %>"<% } %>)
    <%_ } else if (user.primaryKey.fields[0].jpaGeneratedValue) { _%>
    @GeneratedValue
    <%_ } _%>
  <%_ } _%>
  <%_ if (searchEngineElasticsearch && authenticationTypeOauth2) { _%>
    @org.springframework.data.elasticsearch.annotations.Field(type = FieldType.Keyword)
  <%_ } _%>
  <%_ } else { _%>
    <%_ if (user.primaryKey.fields[0].jpaGeneratedValue === 'sequence') { _%>
    @TableId(value = "id", type = IdType.INPUT)
    <%_ } else { _%>
    @TableId(value = "id", type = IdType.AUTO)
    <%_ } _%>
  <%_ } _%>
<%_ } else if (databaseTypeNeo4j) { _%>
    @Id
  <%_ if (!authenticationTypeOauth2) { _%>
    @GeneratedValue(UUIDStringGenerator.class)
  <%_ } _%>
  <%_ if (databaseMigrationLiquibase) { _%>
    @Property("id")
  <%_ } else { _%>
    @Property("user_id")
  <%_ } _%>
<%_ } else { _%>
  <%_ if (databaseTypeMongodb || databaseTypeCouchbase) { _%>
    @Id
  <%_ } _%>
  <%_ if (databaseTypeCouchbase) { _%>
    @GeneratedValue(strategy = USE_ATTRIBUTES, delimiter = ID_DELIMITER)
  <%_ } _%>
  <%_ if (databaseTypeCassandra) { _%>
    <%_ if (reactive) { _%>
    @PrimaryKey
    <%_ } else { _%>
    @PartitionKey
    <%_ } _%>
  <%_ } _%>
  <%_ if (searchEngineElasticsearch) { _%>
    @org.springframework.data.elasticsearch.annotations.Field(type = FieldType.Keyword)
  <%_ } _%>
<%_ } _%>
    private <%= user.primaryKey.type %> id;

    @NotNull
    @Pattern(regexp = Constants.LOGIN_REGEX)
    @Size(min = 1, max = 50)
<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(length = 50, unique = true, nullable = false)
  <%_ } else { _%>
    @TableField(value = "login")
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
    @Indexed
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
    @IdAttribute
<%_ } _%>
    private String login;
<%_ if (!authenticationTypeOauth2) { _%>

    @JsonIgnore
    @NotNull
    @Size(min = 60, max = 60)
  <%_ if (databaseTypeSql && !reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "password_hash", length = 60, nullable = false)
    <%_ } else { _%>
    @TableField(value = "password_hash")
    <%_ } _%>
  <%_ } _%>
  <%_ if (databaseTypeSql && reactive) { _%>
    @Column("password_hash")
  <%_ } _%>
  <%_ if (databaseTypeNeo4j && databaseMigrationLiquibase) { _%>
    @Property("password_hash")
  <%_ } _%>
    private String password;
<%_ } _%>

    @Size(max = 50)
<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "first_name", length = 50)
  <%_ } else { _%>
    @TableField(value = "first_name")
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
    @Column("first_name")
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
    @Field("first_name")
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
    @Field
<%_ } _%>
<%_ if (databaseTypeCassandra && !reactive) { _%>
    @CqlName("firstname")
<%_ } _%>
<%_ if (databaseTypeNeo4j) { _%>
    @Property("first_name")
<%_ } _%>
    private String firstName;

    @Size(max = 50)
<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "last_name", length = 50)
  <%_ } else { _%>
    @TableField(value = "last_name")
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
    @Column("last_name")
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
    @Field("last_name")
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
    @Field
<%_ } _%>
<%_ if (databaseTypeCassandra && !reactive) { _%>
    @CqlName("lastname")
<%_ } _%>
<%_ if (databaseTypeNeo4j) { _%>
    @Property("last_name")
<%_ } _%>
    private String lastName;

    @Email
    @Size(min = 5, max = 254)
<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(length = 254, unique = true)
  <%_ } else { _%>
    @TableField(value = "email")
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
    @Indexed
<%_ } _%>
    private String email;

<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "mobile")
  <%_ } else { _%>
    @TableField(value = "mobile")
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
    @Indexed
<%_ } _%>
    private String mobile;

<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "birthday")
  <%_ } else { _%>
    @TableField(value = "birthday")
  <%_ } _%>
<%_ } _%>
    private ZonedDateTime birthday;

<%_ if (databaseTypeSql) { _%>
    @NotNull
  <%_ if (!reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @Column(nullable = false)
    <%_ } else { _%>
    @TableField(value = "activated")
    <%_ } _%>
  <%_ } _%>
<%_ } _%>
    private boolean activated = false;

    @Size(min = 2, max = 10)
<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "lang_key", length = 10)
  <%_ } else { _%>
    @TableField(value = "lang_key")
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
    @Column("lang_key")
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
    @Field("lang_key")
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
    @Field
<%_ } _%>
<%_ if (databaseTypeNeo4j) { _%>
    @Property("lang_key")
<%_ } _%>
<%_ if (databaseTypeCassandra && reactive) { _%>
    @Column("lang_key")
<%_ } _%>
    private String langKey;
<%_ if (databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase || databaseTypeSql) { _%>

    @Size(max = 256)
  <%_ if (databaseTypeSql && !reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "image_url", length = 256)
    <%_ } else { _%>
    @TableField(value = "image_url")
    <%_ } _%>
  <%_ } _%>
  <%_ if (databaseTypeSql && reactive) { _%>
    @Column("image_url")
  <%_ } _%>
  <%_ if (databaseTypeMongodb) { _%>
    @Field("image_url")
  <%_ } _%>
  <%_ if (databaseTypeCouchbase) { _%>
    @Field
  <%_ } _%>
  <%_ if (databaseTypeNeo4j) { _%>
    @Property("image_url")
  <%_ } _%>
    private String imageUrl;
<%_ } _%>
<%_ if (!authenticationTypeOauth2) { _%>

    @Size(max = 20)
  <%_ if (databaseTypeSql && !reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "activation_key", length = 20)
    <%_ } else { _%>
    @TableField(value = "activation_key")
    <%_ } _%>
  <%_ } _%>
  <%_ if (databaseTypeSql && reactive) { _%>
    @Column("activation_key")
  <%_ } _%>
  <%_ if (databaseTypeMongodb) { _%>
    @Field("activation_key")
  <%_ } _%>
  <%_ if (databaseTypeCouchbase) { _%>
    @Field
  <%_ } _%>
  <%_ if (databaseTypeNeo4j) { _%>
    @Property("activation_key")
  <%_ } _%>
  <%_ if (databaseTypeCassandra && reactive) { _%>
    @Column("activation_key")
  <%_ } _%>
    @JsonIgnore
    private String activationKey;

    @Size(max = 20)
  <%_ if (databaseTypeSql && !reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @Column(name = "reset_key", length = 20)
    <%_ } else { _%>
    @TableField(value = "reset_key")
    <%_ } _%>
  <%_ } _%>
  <%_ if (databaseTypeSql && reactive) { _%>
    @Column("reset_key")
  <%_ } _%>
  <%_ if (databaseTypeMongodb) { _%>
    @Field("reset_key")
  <%_ } _%>
  <%_ if (databaseTypeCouchbase) { _%>
    @Field
  <%_ } _%>
  <%_ if (databaseTypeNeo4j) { _%>
    @Property("reset_key")
  <%_ } _%>
  <%_ if (databaseTypeCassandra && reactive) { _%>
    @Column("reset_key")
  <%_ } _%>
    @JsonIgnore
    private String resetKey;

  <%_ if (databaseTypeSql || (databaseTypeCassandra && reactive)) { _%>
      <%_ if (ormTool === 'hibernate') { _%>
    @Column(<% if (!reactive) { %>name = <% } %>"reset_date")
      <%_ } else { _%>
    @TableField(value = "reset_date")
      <%_ } _%>
  <%_ } else if (databaseTypeMongodb) { _%>
    @Field("reset_date")
  <%_ } else if (databaseTypeCouchbase) { _%>
    @Field
  <%_ } else if (databaseTypeNeo4j) { _%>
    @Property("reset_date")
  <%_ } _%>
    private Instant resetDate = null;
<%_ } _%>
<%_ if (softDelete) { _%>

    <% if (ormTool === 'hibernate') { %>@Column(name = "del_flag")<% } else { %>@TableField(value = "del_flag", fill = FieldFill.INSERT)<% } %>
    <% if (ormTool === 'mybatis') { %>@TableLogic<% } %>
    private Boolean delFlag = false;
<%_ } _%>
<%_ if (useMultiTenant) { _%>

    @TableField(value = "tenant_id")
    private Long tenantId;
<%_ } _%>

    @JsonIgnore
<%_ if (databaseTypeNeo4j) { _%>
    @Relationship("HAS_AUTHORITY")
<%_ } _%>
<%_ if (databaseTypeSql && !reactive) { _%>
  <%_ if (ormTool === 'hibernate') { _%>
    @ManyToMany
    @JoinTable(
        name = "<%= user.entityTableName %>_authority",
        joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")},
        inverseJoinColumns = {@JoinColumn(name = "authority_id", referencedColumnName = "id")})
  <%_ } else { _%>
    @TableField(exist = false)
    @BindEntityList(entity = Authority.class, joinTable = "rel_jhi_user__authorities", joinColumn = "jhi_user_id", inverseJoinColumn = "authorities_id", condition = "this.id=rel_jhi_user__authorities.jhi_user_id AND rel_jhi_user__authorities.authorities_id=id")
  <%_ } _%>
  <%_ if (enableHibernateCache && ormTool === 'hibernate') {
        if (cacheProviderInfinispan) { _%>
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
        <%_ } else { _%>
    @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
        <%_ }
  } _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @BatchSize(size = 20)
    <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
    @Transient
<%_ } _%>
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { _%>
    private <%= manyListName%><Authority> authorities = new <%= manyListType%><>();
<%_ } else { _%>
    private <%= manyListName%><String> authorities = new <%= manyListType%><>();
<%_ } _%>
<%_ if (authenticationTypeSession && databaseTypeSql && !reactive) { _%>

    @JsonIgnore
    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "user")
  <%_ if (enableHibernateCache && ormTool === 'hibernate') { _%>
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  <%_ } _%>
    private <%= manyListName%><PersistentToken> persistentTokens = new <%= manyListType%><>();
<%_ } _%>
<%_ if (ormTool === 'mybatis') { _%>

    @TableField(value = "department_id")
    private Long departmentId;

    @TableField(value = "department_name")
    private String departmentName;

    @TableField(value = "position_id")
    private Long positionId;

    @TableField(value = "position_name")
    private String positionName;
<%_ } _%>

    @JsonIgnore
<%_ if (databaseTypeSql) { _%>
  <%_ if (!reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @ManyToOne
    @JsonIgnoreProperties(value = { "children", "users", "authorities", "parent" }, allowSetters = true)
    <%_ } else { _%>
    @TableField(exist = false)
    @BindEntityList(entity = Department.class, condition = "this.department_id=id")
    <%_ } _%>
  <%_ } else { _%>
    @Transient
  <%_ } _%>
<%_ } else { _%>
  <%_ if (databaseTypeMongodb) { _%>
    @DBRef
  <%_ } _%>
<%_ } _%>
    private Department department;

    @JsonIgnore
<%_ if (databaseTypeSql) { _%>
  <%_ if (!reactive) { _%>
    <%_ if (ormTool === 'hibernate') { _%>
    @ManyToOne
    <%_ } else { _%>
    @TableField(exist = false)
    @BindEntityList(entity = Position.class, condition = "this.position_id=id")
    <%_ } _%>
  <%_ } else { _%>
    @Transient
  <%_ } _%>
<%_ } else { _%>
  <%_ if (databaseTypeMongodb) { _%>
    @DBRef
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeSql && reactive && requiresPersistableImplementation) { _%>

    @Transient
    private boolean isPersisted;
<%_ } _%>

    private Position position;

    public <%= user.primaryKey.type %> getId() {
        return id;
    }

    public void setId(<%= user.primaryKey.type %> id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    // Lowercase the login before saving it in database
    public void setLogin(String login) {
        this.login = StringUtils.lowerCase(login, Locale.ENGLISH);
    }
<%_ if (!authenticationTypeOauth2) { _%>

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
<%_ } _%>

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public ZonedDateTime getBirthday() {
        return birthday;
    }

    public void setBirthday(ZonedDateTime birthday) {
        this.birthday = birthday;
    }
<%_ if (databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase || databaseTypeSql) { _%>

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }
<%_ } _%>

    public boolean isActivated() {
        return activated;
    }

    public void setActivated(boolean activated) {
        this.activated = activated;
    }
<%_ if (!authenticationTypeOauth2) { _%>

    public String getActivationKey() {
        return activationKey;
    }

    public void setActivationKey(String activationKey) {
        this.activationKey = activationKey;
    }

    public String getResetKey() {
        return resetKey;
    }

    public void setResetKey(String resetKey) {
        this.resetKey = resetKey;
    }

    public Instant getResetDate() {
        return resetDate;
    }

    public void setResetDate(Instant resetDate) {
        this.resetDate = resetDate;
    }
  <%_ if (softDelete) { _%>

    public Boolean getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Boolean delFlag) {
        this.delFlag = delFlag;
    }
  <%_ } _%>
  <%_ if (useMultiTenant) { _%>

    public Long getTenantId() {
    return tenantId;
    }

    public void setTenantId(Long tenantId) {
    this.tenantId = tenantId;
    }
  <%_ } _%>
<%_ } _%>

    public String getLangKey() {
        return langKey;
    }

    public void setLangKey(String langKey) {
        this.langKey = langKey;
    }

    public <%= manyListName%><<% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { %>Authority<% } else { %>String<% } %>> getAuthorities() {
        return authorities;
    }

    public void setAuthorities(<%= manyListName%><<% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { %>Authority<% } else { %>String<% } %>> authorities) {
        this.authorities = authorities;
    }
<%_ if (authenticationTypeSession && databaseTypeSql && !reactive) { _%>

    public <%= manyListName%><PersistentToken> getPersistentTokens() {
        return persistentTokens;
    }

    public void setPersistentTokens(<%= manyListName%><PersistentToken> persistentTokens) {
        this.persistentTokens = persistentTokens;
    }
<%_ } _%>
<%_ if (databaseTypeSql && reactive && requiresPersistableImplementation) { _%>

    @Override
    public boolean isNew() {
        return !isPersisted;
    }

    public <%= user.persistClass %> setIsPersisted() {
        this.isPersisted = true;
        return this;
    }
<%_ } _%>
<%_ if (ormTool === 'mybatis') { _%>

    public Long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }

    public Long getPositionId() {
        return positionId;
    }

    public void setPositionId(Long positionId) {
        this.positionId = positionId;
    }

    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    public Department getDepartment() {
        return department;
    }

    public void setPositionName(String positionName) {
        this.positionName = positionName;
    }

    public String getPositionName() {
        return positionName;
    }


    public void setDepartment(Department department) {
        this.department = department;
    }
<%_ } _%>

    public Position getPosition() {
        return position;
    }

    public void setPosition(Position position) {
        this.position = position;
    }
<%_ if (ormTool === 'hibernate') { _%>

     public User addAuthorities(Authority authority) {
        this.authorities.add(authority);
        return this;
    }

    public User removeAuthorities(Authority authority) {
        this.authorities.remove(authority);
        return this;
    }
<%_ } _%>

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof <%= user.persistClass %>)) {
            return false;
        }
        return id != null && id.equals(((<%= user.persistClass %>) o).id);
    }

    @Override
    public int hashCode() {
        // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
        return getClass().hashCode();
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "<%= user.persistClass %>{" +
            "login='" + login + '\'' +
            ", firstName='" + firstName + '\'' +
            ", lastName='" + lastName + '\'' +
            ", email='" + email + '\'' +
            ", mobile='" + mobile + '\'' +
            ", birthday='" + birthday + '\'' +
<%_ if (databaseTypeMongodb || databaseTypeCouchbase || databaseTypeSql) { _%>
            ", imageUrl='" + imageUrl + '\'' +
<%_ } _%>
            ", activated='" + activated + '\'' +
<%_ if (softDelete) { _%>
            ", delFlag='" + delFlag + '\'' +
<%_ } _%>
<%_ if (useMultiTenant) { _%>
            ", tenantId='" + tenantId + '\'' +
<%_ } _%>
            ", langKey='" + langKey + '\'' +
<%_ if (!authenticationTypeOauth2) { _%>
            ", activationKey='" + activationKey + '\'' +
<%_ } _%>
            "}";
    }
}
