package public

import (
	"context"
	"time"

	"source.gleipnir.technology/Gleipnir/nidus-sync/db"
	"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/public/model"
	"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/public/table"
	//"github.com/Gleipnir-Technology/jet/postgres"
)

func CommunicationLogEntryInsert(ctx context.Context, txn db.Tx, m model.CommunicationLogEntry) (model.CommunicationLogEntry, error) {
	m.Created = time.Now()
	statement := table.CommunicationLogEntry.INSERT(table.CommunicationLogEntry.MutableColumns).
		MODEL(m).
		RETURNING(table.CommunicationLogEntry.AllColumns)
	return db.ExecuteOne[model.CommunicationLogEntry](ctx, statement)
}
