package study.u43.model;

import java.time.Instant;
import jakarta.persistence.*;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Entity @Table(name="u43_account") @EntityListeners(AuditingEntityListener.class)
public class Account {
    @Id private Long id;
    @Version private Long version;
    @Column(nullable=false) private String name;
    @CreatedDate @Column(name="created_at", nullable=false, updatable=false) private Instant createdAt;
    protected Account() { }
    public Account(long id, String name) { this.id=id; this.name=name; }
    public Long getId() { return id; }
    public String getName() { return name; }
    public void setName(String name) { this.name=name; }
    public Long getVersion() { return version; }
    public Instant getCreatedAt() { return createdAt; }
}
