package entities

import (
	"time"

	"github.com/google/uuid"
)

type LetterIncomingRecipientStatus string

const (
	RecipientStatusNew       LetterIncomingRecipientStatus = "new"
	RecipientStatusRead      LetterIncomingRecipientStatus = "read"
	RecipientStatusCompleted LetterIncomingRecipientStatus = "completed"
)

type LetterIncomingRecipient struct {
	ID                    uuid.UUID                     `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
	LetterID              uuid.UUID                     `gorm:"type:uuid;not null" json:"letter_id"`
	RecipientUserID       *uuid.UUID                    `json:"recipient_user_id,omitempty"`
	RecipientDepartmentID *uuid.UUID                    `json:"recipient_department_id,omitempty"`
	Status                LetterIncomingRecipientStatus `gorm:"not null;default:'new'" json:"status"`
	ReadAt                *time.Time                    `json:"read_at,omitempty"`
	CompletedAt           *time.Time                    `json:"completed_at,omitempty"`
	CreatedAt             time.Time                     `gorm:"autoCreateTime" json:"created_at"`
}

func (LetterIncomingRecipient) TableName() string { return "letter_incoming_recipients" }
