package com.bio.bio_backend.global.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import org.hibernate.annotations.Comment;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;



/**
 * 모든 엔티티가 상속받는 기본 엔티티 클래스
 * 공통 필드들을 정의하고 JPA Auditing을 지원합니다.
 */
@Getter
@Setter
@MappedSuperclass
@EntityListeners({AuditingEntityListener.class, BaseEntityListener.class})
public abstract class BaseEntity {

    @Id
    @Column(name = "oid", nullable = false)
    @Comment("OID")
    private Long oid;

    @CreatedDate
    @Column(name = "created_at", nullable = false, updatable = false)
    @Comment("생성일시")
    private LocalDateTime createdAt;

    @LastModifiedDate
    @Column(name = "updated_at", nullable = false)
    @Comment("수정일시")
    private LocalDateTime updatedAt;

    @Column(name = "created_oid", updatable = false)
    @Comment("생성자 OID")
    private Long createdOid;

    @Column(name = "updated_oid")
    @Comment("수정자 OID")
    private Long updatedOid;

    @Column(name = "created_id", updatable = false)
    @Comment("생성자 ID")
    private String createdId;

    @Column(name = "updated_id")
    @Comment("수정자 ID")
    private String updatedId;
    
}
