package book

import "time"

type BookReadRecord struct {
	HardDeleteModel
	MemberUserID      uint      `json:"memberUserId" form:"memberUserId" gorm:"not null;uniqueIndex:uk_book_read_record_member_user_id_book_id;index:idx_book_read_record_member_user_id_last_read_at;comment:会员用户 ID"`
	BookID            uint      `json:"bookId" form:"bookId" gorm:"not null;uniqueIndex:uk_book_read_record_member_user_id_book_id;index;comment:书籍 ID"`
	BookTitleSnapshot string    `json:"bookTitleSnapshot" form:"bookTitleSnapshot" gorm:"type:varchar(255);not null;comment:书名快照"`
	ReadProgress      float64   `json:"readProgress" form:"readProgress" gorm:"type:numeric(5,2);not null;default:0.00;comment:阅读进度百分比"`
	ChapterID         uint      `json:"chapterId" form:"chapterId" gorm:"not null;comment:续读章节 ID"`
	LineIndex         int       `json:"lineIndex" form:"lineIndex" gorm:"not null;comment:续读文本行序号"`
	LastReadAt        time.Time `json:"lastReadAt" form:"lastReadAt" gorm:"not null;default:CURRENT_TIMESTAMP;index:idx_book_read_record_member_user_id_last_read_at;comment:最后阅读时间"`
}

func (BookReadRecord) TableName() string {
	return "book_read_record"
}
