Files
mtusi2026lab6/internal/model/dto/attachment.go
T

58 lines
1.7 KiB
Go

package dto
import (
"time"
"github.com/google/uuid"
)
// Attachment contains private persistence metadata and the public file description.
type Attachment struct {
// Variants contains generated immutable objects.
Variants []Variant
// ErrorCode is a safe terminal failure category.
ErrorCode *string
// PipelineVersion fences older processing jobs.
PipelineVersion int
// ID identifies the immutable upload.
ID uuid.UUID
// ChatID defines the authorization scope.
ChatID uuid.UUID
// OwnerID identifies the uploader.
OwnerID uuid.UUID
// Filename is display-only and never an object path.
Filename string
// ContentType is validated against decoded bytes.
ContentType string
// SizeBytes is the original encoded length.
SizeBytes int64
// SHA256 is the lowercase original checksum.
SHA256 string
// Status is the durable upload state.
Status string
// ObjectKey is private and must not reach HTTP responses.
ObjectKey string
// CreatedAt is the reservation timestamp.
CreatedAt time.Time
// UpdatedAt is the latest durable transition.
UpdatedAt time.Time
}
// Variant describes a generated object; ObjectKey is persistence-only.
type Variant struct {
// Name is the contract variant name.
Name string `json:"name"`
// ContentType identifies the actual encoding.
ContentType string `json:"content_type"`
// Width is the decoded pixel width.
Width int `json:"width"`
// Height is the decoded pixel height.
Height int `json:"height"`
// SizeBytes is the encoded length.
SizeBytes int64 `json:"size_bytes"`
// SHA256 is the encoded checksum.
SHA256 string `json:"sha256"`
// ObjectKey is not copied into HTTP responses.
ObjectKey string `json:"object_key,omitempty"`
}