package purchase

import (
	"hongze/hongze_yb/models/response"
	"time"
)

type PurchaseListItem struct {
	item
	Unread             int    `description:"未读数" json:"unread"`
}

type DetailResp struct {
	List []*Detail  `json:"list"`
	Paging  *response.PagingItem `json:"paging"`
}

type Detail struct {
	item
	TopName         string   `description:"主标题" json:"top_name"`
}

type item struct {
	ReportId           int    `description:"报告Id" json:"report_id"`
	ActivityId		   int 	  `description:"活动ID" json:"activity_id"`
	ClassifyIdFirst    int    `description:"一级分类id" json:"classify_id_first"`
	ClassifyNameFirst  string `description:"一级分类名称" json:"classify_name_first"`
	ClassifyIdSecond   int    `description:"二级分类id" json:"classify_id_second"`
	ClassifyNameSecond string `description:"二级分类名称" json:"classify_name_second"`
	Title              string `description:"标题" json:"title"`
	Content            string `description:"简介" json:"content"`
	Stage              int	  `description:"期数" json:"stage"`
	Time               time.Time `description:"更新时间" json:"time"`
	ImgUrl             string   `description:"背景图地址" json:"img_url"`
}

type PurchaseList []*PurchaseListItem

func (p PurchaseList) Len() int {
	return len(p)
}

func (p PurchaseList) Less(i, j int) bool {
	if p[i].Time.Before(p[j].Time) {
		return false
	}
	return true
}

func (p PurchaseList) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

