<%#
 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 %>.repository.timezone;

<%_ if (ormTool === 'hibernate') { _%>
import <%= javaVersion === '17' ? 'jakarta' : 'javax'%>.persistence.*;
<%_ } else { _%>
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
<%_ } _%>
import java.io.Serializable;
import java.time.*;
import java.util.Objects;

<%_ if (ormTool !== 'mybatis') { _%>
@Entity
@Table(name = "<%= jhiTablePrefix %>_date_time_wrapper")
<%_ } else { _%>
@TableName(value = "<%= jhiTablePrefix %>_date_time_wrapper")
<%_ } _%>
public class DateTimeWrapper implements Serializable {

    private static final long serialVersionUID = 1L;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Id
<%_ if (prodDatabaseTypeMysql) { _%>
    @GeneratedValue(strategy = GenerationType.IDENTITY)
<%_ } else { _%>
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
    @SequenceGenerator(name = "sequenceGenerator")
    <%_ } _%>
    <%_ } else { _%>
    @TableId(value = "id", type = IdType.AUTO)
    <%_ } _%>
    private Long id;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "instant")
    <%_ } else { _%>
    @TableField(value = "instant")
    <%_ } _%>
    private Instant instant;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "local_date_time")
    <%_ } else { _%>
    @TableField(value = "local_date_time")
    <%_ } _%>
    private LocalDateTime localDateTime;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "offset_date_time")
    <%_ } else { _%>
    @TableField(value = "offset_date_time")
    <%_ } _%>
    private OffsetDateTime offsetDateTime;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "zoned_date_time")
    <%_ } else { _%>
    @TableField(value = "zoned_date_time")
    <%_ } _%>
    private ZonedDateTime zonedDateTime;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "local_time")
    <%_ } else { _%>
    @TableField(value = "local_time")
    <%_ } _%>
    private LocalTime localTime;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "offset_time")
    <%_ } else { _%>
    @TableField(value = "offset_time")
    <%_ } _%>
    private OffsetTime offsetTime;

    <%_ if (ormTool !== 'mybatis') { _%>
    @Column(name = "local_date")
    <%_ } else { _%>
    @TableField(value = "local_date")
    <%_ } _%>
    private LocalDate localDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Instant getInstant() {
        return instant;
    }

    public void setInstant(Instant instant) {
        this.instant = instant;
    }

    public LocalDateTime getLocalDateTime() {
        return localDateTime;
    }

    public void setLocalDateTime(LocalDateTime localDateTime) {
        this.localDateTime = localDateTime;
    }

    public OffsetDateTime getOffsetDateTime() {
        return offsetDateTime;
    }

    public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
        this.offsetDateTime = offsetDateTime;
    }

    public ZonedDateTime getZonedDateTime() {
        return zonedDateTime;
    }

    public void setZonedDateTime(ZonedDateTime zonedDateTime) {
        this.zonedDateTime = zonedDateTime;
    }

    public LocalTime getLocalTime() {
        return localTime;
    }

    public void setLocalTime(LocalTime localTime) {
        this.localTime = localTime;
    }

    public OffsetTime getOffsetTime() {
        return offsetTime;
    }

    public void setOffsetTime(OffsetTime offsetTime) {
        this.offsetTime = offsetTime;
    }

    public LocalDate getLocalDate() {
        return localDate;
    }

    public void setLocalDate(LocalDate localDate) {
        this.localDate = localDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DateTimeWrapper dateTimeWrapper = (DateTimeWrapper) o;
        return !(dateTimeWrapper.getId() == null || getId() == null) && Objects.equals(getId(), dateTimeWrapper.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "TimeZoneTest{" +
            "id=" + id +
            ", instant=" + instant +
            ", localDateTime=" + localDateTime +
            ", offsetDateTime=" + offsetDateTime +
            ", zonedDateTime=" + zonedDateTime +
            '}';
    }
}
