package <%= packageName %>.domain;

<%_ if (javaVersion === '17') { _%>
import jakarta.persistence.PreUpdate;
<%_ } else { _%>
import javax.persistence.PreUpdate;
<%_ } _%>

import java.time.ZonedDateTime;

public interface SoftDeleteEntity {
    Boolean getDelFlag();

    void setDelFlag(Boolean delFlag);

    ZonedDateTime getDeletedTime();

    void setDeletedTime(ZonedDateTime deletedTime);

    @PreUpdate
    default void updateDeletedTime() {
        if (this.getDelFlag()) {
            this.setDeletedTime(ZonedDateTime.now());
        } else {
            this.setDeletedTime(null);
        }
    }
}
