package engineer

import (
	"time"
)

type DispatchState struct {
	DispatchEnabled     bool       `gorm:"column:dispatch_enabled;not null;default:true;index:idx_engineer_eligibility"`
	LastDispatchedAt    *time.Time `gorm:"column:last_dispatched_at;type:datetime(3);index"`
	LastDispatchedIssue string     `gorm:"column:last_dispatched_issue;type:varchar(255);not null;default:''"`
}

type Engineer struct {
	Email         string        `gorm:"column:email;type:varchar(320);primaryKey"`
	DispatchState DispatchState `gorm:"embedded"`
	CreatedAt     time.Time     `gorm:"column:created_at;type:timestamp;not null;<-:create"`
	UpdatedAt     *time.Time    `gorm:"column:updated_at;type:timestamp"`
}

func (Engineer) TableName() string {
	return "engineer_engineers"
}
