package models

import "go.mongodb.org/mongo-driver/v2/bson"

type ProcessType string

const (
	SendParentEmail ProcessType = "SEND_PARENT_EMAIL"
	SendChildEmail  ProcessType = "SEND_CHILD_EMAIL"

	// steps before the mail, logged only when they fail
	FetchReport       ProcessType = "FETCH_REPORT"
	RegenerateReport  ProcessType = "REGENERATE_REPORT"
	LoadSender        ProcessType = "LOAD_SENDER"
	PrepareChildEmail ProcessType = "PREPARE_CHILD_EMAIL"
)

type ReportEmailQueueLog struct {
	ID           bson.ObjectID     `bson:"_id,omitempty" json:"id"`
	QueueId      string            `bson:"queue_id" json:"queue_id"`
	DivisionId   string            `bson:"division_id" json:"divisio_id"`
	DivisionName string            `bson:"division_name" json:"division_name"`
	ProcessType  ProcessType       `bson:"process_type" json:"process_type"`
	UserId       string            `bson:"user_id" json:"user_id"`
	DeviceTypeId int               `bson:"device_type_id" json:"device_type_id"`
	ReportDate   int64             `bson:"report_date" json:"report_date"`
	Status       ReportEmailStatus `bson:"status" json:"status"`
	SentTo       string            `bson:"sent_to" json:"sent_to"`
	ErrorMessage string            `bson:"error_message" json:"error_message"`
	StartedAt    int64             `bson:"started_at" json:"started_at"`
	FinishedAt   int64             `bson:"finished_at" json:"finished_at"`
}
