package entities

import (
	"time"

	"github.com/google/uuid"
)

type File struct {
	ID             uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
	OrganizationID uuid.UUID `gorm:"type:uuid;not null" json:"organization_id"`
	UserID         uuid.UUID `gorm:"type:uuid;not null" json:"user_id"`
	FileName       string    `gorm:"size:255;not null" json:"file_name"`
	OriginalName   string    `gorm:"size:255;not null" json:"original_name"`
	FileURL        string    `gorm:"size:500;not null" json:"file_url"`
	FileSize       int64     `gorm:"not null" json:"file_size"`
	MimeType       string    `gorm:"size:100;not null" json:"mime_type"`
	FileType       string    `gorm:"size:50;not null" json:"file_type"` // image, document, video, etc.
	UploadPath     string    `gorm:"size:500;not null" json:"upload_path"`
	IsPublic       bool      `gorm:"default:true" json:"is_public"`
	Metadata       Metadata  `gorm:"type:jsonb" json:"metadata"`
	CreatedAt      time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt      time.Time `gorm:"autoUpdateTime" json:"updated_at"`
}

func (File) TableName() string {
	return "files"
}
