package talent_model

import (
	"github.com/gogf/gf/database/gdb"
	"github.com/gogf/gf/os/gtime"
	"github.com/gogf/gf/util/gmeta"
)

type TaskBrandInfo struct {
	gmeta.Meta `orm:"table:brand"`
	BrandId    int    `json:"-"`
	BrandName  string `json:"brand_name"`
	BrandLogo  string `json:"brand_logo"`
	BrandInfo  string `json:"brand_info"`
}

type TaskHelpInfo struct {
	gmeta.Meta          `orm:"table:task_perform_help_info"`
	BrandKeyword        string `json:"brand_keyword"`
	ProductMerits       string `json:"product_merits"`
	AppendTopic         string `json:"append_topic"`
	CaptureRequirement  string `json:"capture_requirement"`
	RemainDays          int    `json:"remain_days"`
	OtherPerformRequire string `json:"other_perform_require"`
	CaptureReference    string `json:"capture_reference"`
	CustomServiceQrcode string `json:"custom_service_qrcode"`
	BriefList           string `json:"brief_list"`
	TaskBaseId          int    `json:"-"`
}

type WorkflowNodes struct {
	gmeta.Meta    `orm:"table:workflow_node_container"`
	OrderId       int    `json:"-"`
	TaskFlag      int    `orm:"where:task_flag=1" json:"task_flag"`
	NodeNameFirst string `json:"node_name_first"`
	SortId        int    `orm:"order:sort_id asc" json:"sort_id"`
}

type TaskRecruitRequest struct {
	gmeta.Meta       `orm:"table:task_recruit_requirements"`
	TaskBaseId       int    `json:"-"`
	TalentSkillsOn   string `json:"talent_skills_on"`
	InteractType     string `json:"interact_type"`
	RegionCode       int    `json:"region_code"`
	Gender           int    `json:"gender"`
	OtherRequirement string `json:"other_requirement"`
}

type TaskRewardInfo struct {
	gmeta.Meta       `orm:"table:task_reward"`
	TaskBaseId       int    `json:"-"`
	IsRewardGoods    bool   `json:"is_reward_goods"`
	RewardGoodsInfo  string `json:"reward_goods_info"`
	IsPaymentArticle bool   `json:"is_payment_article"`
	PaymentValue     string  `json:"payment_value"`
	OtherRewardInfo  string `json:"other_reward_info"`
}

type BuySamplesCost struct {
	gmeta.Meta       `orm:"table:task_procedure_buy_samples_info"`
	TaskBaseId       int   `json:"-"`
	BuySamplesCost   int64 `json:"buy_samples_cost"`
	BuySamplesRefund int64 `json:"buy_samples_refund"`
}

type IsBuySamples struct {
	gmeta.Meta       `orm:"table:task_procedure_decision_condition"`
	TaskBaseId       int   `json:"-"`
	BuySamplesType   int   `json:"buy_samples_type"`
	BuySamplesCost   int64 `json:"buySamplesCost"`   // 拍单费用
	BuySamplesRefund int64 `json:"buySamplesRefund"` // 拍单退费
}

type OrderInfo struct {
	gmeta.Meta `orm:"table:order_info"`
	SignupId   int `json:"signup_id"`
	TaskId     int `json:"task_id"`
	TalentId   int `json:"talent_id"`
}

type NeedTalentCount struct {
	gmeta.Meta      `orm:"table:task_recruit_talent_level"`
	TrtId           int   `json:"trt_id"`
	TaskBaseId      int   `json:"-"`
	FansCountMin    int   `json:"fans_count_min"`
	FansCountMax    int   `json:"fans_count_max"`
	NeedTalentCount int   `json:"need_talent_count"`
	RewardRoyalties int64 `json:"reward_royalties"`
	SignupCount     int64 `json:"signup_count"`
}

type ProductPhoto struct {
	gmeta.Meta `orm:"table:product_photo"`
	//Id int					`json:"id"`
	ProductId int    `json:"-"`
	Symbol    int    `json:"symbol"`
	PhotoUrl  string `json:"photo_url"`
}

type ProductInfo struct {
	gmeta.Meta           `orm:"table:product"`
	ProductId            int             `json:"-"`
	ProductName			 string			 `json:"product_name"`
	ProductPrice         int64           `json:"product_price"`
	ProductSpecification string          `json:"product_specification"`
	ProductImages        []*ProductPhoto `orm:"with:product_id=product_id"`
}

type PlatformInfo struct {
	gmeta.Meta `orm:"table:info_third_platform"`
	PlatformId int `json:"platform_id"`
	PlatformIcon string `json:"platform_icon"`
	PlatformTableName string `json:"platform_table_name"`
}

type TaskDetail struct {
	gmeta.Meta         `orm:"table:task_base_info"`
	TaskId             int                 `json:"task_id"`
	TaskMode          int                  `json:"task_mode"`
	TaskName           string              `json:"task_name"`
	TaskPlatform       int                 `json:"task_platform"`
	ContentForm        int                 `json:"content_form"`
	OtherForm          int                 `json:"other_form"`
	TaskStatus         int                 `json:"task_status"`     // 任务状态：1待支付（待上线）  2执行中  3已结案
	StartTime          gtime.Time          `json:"start_time"`
	EndTime            gtime.Time          `json:"end_time"`
	DeadlineTime       gtime.Time          `json:"deadline_time"`
	ProductId          int                 `json:"-"`
	BrandId            int                 `json:"-"`
	ProductInfo        *ProductInfo        `orm:"with:product_id=product_id"`
	NeedTalentCount    []*NeedTalentCount  `orm:"with:task_base_id=task_id, order:fans_count_min asc"`
	TaskSignUpInfo     []*OrderInfo        `orm:"with:task_id=task_id"`
	IsBuySamples       *IsBuySamples       `orm:"with:task_base_id=task_id"`
	//BuySamplesCost     *BuySamplesCost     `orm:"with:task_base_id=task_id"`
	TaskRewardInfo     *TaskRewardInfo     `orm:"with:task_base_id=task_id"`
	TaskRecruitRequest *TaskRecruitRequest `orm:"with:task_base_id=task_id"`
	TaskHelpInfo       *TaskHelpInfo       `orm:"with:task_base_id=task_id"`
	TaskBrandInfo      *TaskBrandInfo      `orm:"with:brand_id=brand_id"`
	PlatformInfo       *PlatformInfo       `orm:"with:platform_id=task_platform"`
}

type SignupPageTaskDetail struct {
	gmeta.Meta         `orm:"table:task_base_info"`
	TaskId             int                 `json:"task_id"`
	TaskModel          int                 `json:"task_model"`
	TaskName           string              `json:"task_name"`
	TaskPlatform       int                 `json:"task_platform"`
	ContentForm        int                 `json:"content_form"`
	OtherForm          int                 `json:"other_form"`
	StartTime          gtime.Time          `json:"start_time"`
	EndTime            gtime.Time          `json:"end_time"`
	DeadlineTime       gtime.Time          `json:"deadline_time"`
	ProductId          int                 `json:"-"`
	BrandId            int                 `json:"-"`
	ProductInfo        *ProductInfo        `orm:"with:product_id=product_id"`
	NeedTalentCount    []*NeedTalentCount  `orm:"with:task_base_id=task_id, order:fans_count_min asc"`
	TaskSignUpInfo     []*OrderInfo        `orm:"with:task_id=task_id"`
	IsBuySamples       *IsBuySamples       `orm:"with:task_base_id=task_id"`
	//BuySamplesCost     *BuySamplesCost     `orm:"with:task_base_id=task_id"`
	TaskRewardInfo     *TaskRewardInfo     `orm:"with:task_base_id=task_id"`
	TaskRecruitRequest *TaskRecruitRequest `orm:"with:task_base_id=task_id"`
	TaskHelpInfo       *TaskHelpInfo       `orm:"with:task_base_id=task_id"`
	TaskBrandInfo      *TaskBrandInfo      `orm:"with:brand_id=brand_id"`
	PlatformInfo       *PlatformInfo       `orm:"with:platform_id=task_platform"`
	DeliveryAddress    *gdb.Record `json:"delivery_address"`
	PlatformDetail     *gdb.Record `json:"platform_detail"`
}

type FansCountAndTaskSignupInfo struct {
	FansCountInfo gdb.Record `json:"fans_count_info"`
	IsSignupTask  int        `json:"is_signup_task"`
}
