package dto import ( "time" "mtusi2026lab4/internal/domain" ) type AttachmentVariantResponse struct { Name string `json:"name"` ContentType string `json:"content_type"` SizeBytes int64 `json:"size_bytes"` Width int `json:"width"` Height int `json:"height"` SHA256 string `json:"sha256"` } type AttachmentResponse struct { ID string `json:"id"` ChatID string `json:"chat_id"` OwnerID string `json:"owner_id"` Filename string `json:"filename"` ContentType string `json:"content_type"` SizeBytes int64 `json:"size_bytes"` SHA256 string `json:"sha256"` Status domain.AttachmentStatus `json:"status"` Variants []AttachmentVariantResponse `json:"variants"` ErrorCode *string `json:"error_code"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func AttachmentFromDomain(attachment domain.Attachment) AttachmentResponse { variants := make([]AttachmentVariantResponse, 0, len(attachment.Variants)) for _, variant := range attachment.Variants { variants = append(variants, AttachmentVariantResponse{ Name: variant.Name, ContentType: variant.ContentType, SizeBytes: variant.SizeBytes, Width: variant.Width, Height: variant.Height, SHA256: variant.SHA256, }) } return AttachmentResponse{ ID: attachment.ID, ChatID: attachment.ChatID, OwnerID: attachment.OwnerID, Filename: attachment.Filename, ContentType: attachment.ContentType, SizeBytes: attachment.SizeBytes, SHA256: attachment.SHA256, Status: attachment.Status, Variants: variants, ErrorCode: attachment.ErrorCode, CreatedAt: attachment.CreatedAt, UpdatedAt: attachment.UpdatedAt, } }