package vulnmodel

import (
	coremodel "security-center-backend/internal/model"
)

type VulnerabilityAttachmentStatus string

const (
	AttachmentStatusPending  VulnerabilityAttachmentStatus = "pending"
	AttachmentStatusReady    VulnerabilityAttachmentStatus = "ready"
	AttachmentStatusRejected VulnerabilityAttachmentStatus = "rejected"
)

// VulnerabilityAttachment tracks uploaded files (images only) stored in S3.
// The UI embeds references using data attributes (e.g. data-sc-attachment-id) rather than direct URLs.
type VulnerabilityAttachment struct {
	coremodel.Base
	VulnerabilityID *uint64                       `gorm:"index" json:"vulnerability_id"`
	UploaderID      uint64                        `gorm:"index" json:"uploader_id"`
	S3Bucket        string                        `gorm:"size:128;index:idx_vuln_attachments_s3,priority:1" json:"s3_bucket"`
	S3Key           string                        `gorm:"size:1024;index:idx_vuln_attachments_s3,priority:2,length:191" json:"s3_key"`
	ContentType     string                        `gorm:"size:120" json:"content_type"`
	SizeBytes       int64                         `json:"size_bytes"`
	Status          VulnerabilityAttachmentStatus `gorm:"size:20;index" json:"status"`
}
