package collaboration

import modbase "github.com/tidbcloud/aisupport/services/ticket-manager/models/base"

type Resource struct {
	modbase.Base

	TicketID       modbase.ID `gorm:"column:ticket_id;not null;index:idx_ticket_id"`
	Type           string     `gorm:"column:resource_type;type:varchar(255);not null;uniqueIndex:idx_collaboration_resource_identity,priority:1"`
	Provider       string     `gorm:"column:resource_provider;type:varchar(255);not null;uniqueIndex:idx_collaboration_resource_identity,priority:2"`
	ResourceID     string     `gorm:"column:resource_id;type:varchar(255);not null;uniqueIndex:idx_collaboration_resource_identity,priority:3"`
	Name           string     `gorm:"column:resource_name;type:varchar(255);not null"`
	Link           string     `gorm:"column:resource_link;type:text"`
	Owner          string     `gorm:"column:owner;type:varchar(255)"`
	GrantStatus    string     `gorm:"column:grant_status;type:varchar(255);not null;default:created;index:idx_grant_status"`
	GrantRequestID *string    `gorm:"column:grant_request_id;type:varchar(255)"`
	Metadata       []byte     `gorm:"column:metadata;type:json"`
}

func (Resource) TableName() string {
	return "collaboration_resources"
}
