package entity

import (
	users "campaign-pool-be/app/database/entity/users"
	"time"
	"gorm.io/gorm"
)

type Campaigns struct {
	ID                 uint           `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
	Title              string         `json:"title" gorm:"type:varchar(255)"`
	CampaignTypeID     uint           `json:"campaign_type_id" gorm:"type:int4"`
	CampaignType       CampaignTypes  `json:"campaign_type" gorm:"foreignKey:CampaignTypeID;references:ID"`
	StartDate          *time.Time     `json:"start_date" gorm:"type:date"`
	EndDate            *time.Time     `json:"end_date" gorm:"type:date"`
	MediaTypeSelected  *string        `json:"media_type_selected" gorm:"type:varchar(100)"`
	MediaItemSelected  *string        `json:"media_item_selected" gorm:"type:text"` // JSON array or comma-separated
	Purpose            *string        `json:"purpose" gorm:"type:text"`
	MediaPromote       *bool          `json:"media_promote" gorm:"type:bool;default:false"`
	Description        *string        `json:"description" gorm:"type:text"`
	CreatorID          uint           `json:"creator_id" gorm:"type:int4"`
	Creator            users.Users    `json:"creator" gorm:"foreignKey:CreatorID;references:ID"`
	Status             string         `json:"status" gorm:"type:varchar(50);default:'draft'"` // draft, waiting_approval, approved, rejected, published, archived
	IsActive           *bool          `json:"is_active" gorm:"type:bool;default:true"`
	CreatedAt          time.Time      `json:"created_at" gorm:"default:now()"`
	UpdatedAt          time.Time      `json:"updated_at" gorm:"default:now()"`
	DeletedAt          gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

