package cokr.xit.ens.biz.traffic.chuncheon.mydoc.domain.embeded;

import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.PreUpdate;
import java.time.LocalDateTime;

@Embeddable
@Getter
@RequiredArgsConstructor
public class FieldUpdate {

//	@UpdateTimestamp
//	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "updt_dt")
	private LocalDateTime updtDt;
	@Column(name = "updusr", length = 50)
	private String updusr;

	@PreUpdate
	public void preUpdate() {
		this.updtDt = LocalDateTime.now();
	}

	@Builder(builderMethodName = "builder")
	public FieldUpdate(String updusr, LocalDateTime updtDt) {
		this.updusr = updusr;
		this.updtDt = updtDt;
	}
}
