package models import ( "time" "github.com/google/uuid" // Pastikan import ini ada ) type User struct { // WAJIB UUID UserID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primaryKey" json:"user_id"` NrpNip string `gorm:"unique;not null" json:"nrp_nip"` FullName string `gorm:"not null" json:"full_name"` Email string `gorm:"unique;not null" json:"email"` Phone string `gorm:"not null" json:"phone"` PasswordHash string `gorm:"not null" json:"-"` Role string `gorm:"type:user_role;default:'student'" json:"role"` CreatedAt time.Time `json:"created_at"` } type Room struct { RoomID uint `gorm:"primaryKey" json:"room_id"` Name string `gorm:"not null" json:"name"` Category string `gorm:"not null" json:"category"` Capacity int `gorm:"not null" json:"capacity"` Floor string `gorm:"not null" json:"floor"` Status string `gorm:"type:room_status;default:'Available'" json:"status"` } type Booking struct { BookingID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primaryKey" json:"booking_id"` UserID uuid.UUID `gorm:"type:uuid;not null" json:"user_id"` User User `gorm:"foreignKey:UserID;references:UserID" json:"user,omitempty"` RoomID uint `gorm:"not null" json:"room_id"` Room Room `gorm:"foreignKey:RoomID;references:RoomID" json:"room"` StartTime time.Time `gorm:"not null" json:"start_time"` EndTime time.Time `gorm:"not null" json:"end_time"` Purpose string `gorm:"not null" json:"purpose"` Status string `gorm:"type:booking_status;default:'Pending'" json:"status"` // 👇 PASTIKAN BARIS INI ADA DI DALAM SINI 👇 RedeemCode string `gorm:"type:varchar(10)" json:"redeem_code"` CreatedAt time.Time `json:"created_at"` }