package com.bio.bio_backend.domain.user.member.entity;

import com.bio.bio_backend.domain.user.member.enums.MemberRole;
import com.bio.bio_backend.global.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;

@Entity
@Getter @Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(
    name = "st_member",
    indexes = {
        @Index(name = "idx_member_user_id", columnList = "user_id")
    }
)
public class Member extends BaseEntity {

    @Column(name = "user_id", nullable = false, length = 100)
    private String userId;

    @Column(name = "password", nullable = false, length = 100)
    private String password;

    @Enumerated(EnumType.STRING)
    @Column(name = "role", nullable = false, length = 40)
    private MemberRole role;

    @Column(name = "use_flag", nullable = false)
    @Builder.Default
    private Boolean useFlag = true;

    @Column(name = "refresh_token", length = 200)
    private String refreshToken;

    @Column(name = "last_login_at")
    private LocalDateTime lastLoginAt;
    
}