package pack

import (
	"github.com/issue9/conv"
	"youngee_b_api/model/http_model"
)

func MGormSpecialTaskSettleInfoListToHttpSpecialTaskSettlePreviewList(gormSpecialTaskSettleInfos []*http_model.SpecialTaskSettleInfo) []*http_model.SpecialTaskSettlePreview {
	var httpProjectPreviews []*http_model.SpecialTaskSettlePreview
	for _, gormSpecialTaskSettleInfo := range gormSpecialTaskSettleInfos {
		httpSpecialTaskSettlePreview := MGormSpecialTaskSettleInfoToHttpSpecialTaskSettlePreview(gormSpecialTaskSettleInfo)
		httpProjectPreviews = append(httpProjectPreviews, httpSpecialTaskSettlePreview)
	}
	return httpProjectPreviews
}

func MGormSpecialTaskSettleInfoToHttpSpecialTaskSettlePreview(SpecialTaskSettleInfo *http_model.SpecialTaskSettleInfo) *http_model.SpecialTaskSettlePreview {
	return &http_model.SpecialTaskSettlePreview{
		TaskID:           conv.MustString(SpecialTaskSettleInfo.TaskID, ""),
		PlatformNickname: conv.MustString(SpecialTaskSettleInfo.PlatformNickname, ""),
		FansCount:        conv.MustString(SpecialTaskSettleInfo.FansCount, ""),
		PlayNumber:       SpecialTaskSettleInfo.PlayNumber,
		LikeNumber:       SpecialTaskSettleInfo.LikeNumber,
		CommentNumber:    SpecialTaskSettleInfo.CommentNumber,
		CollectNumber:    SpecialTaskSettleInfo.CollectNumber,
		LinkUrl:          SpecialTaskSettleInfo.LinkUrl,
		PhotoUrl:         SpecialTaskSettleInfo.PhotoUrl,
		AllPayment:       SpecialTaskSettleInfo.AllPayment,
		RealPayment:      SpecialTaskSettleInfo.RealPayment,
		ReviseOpinion:    SpecialTaskSettleInfo.ReviseOpinion,
		Phone:            SpecialTaskSettleInfo.Phone,
		SubmitAt:         conv.MustString(SpecialTaskSettleInfo.SubmitAt, "")[0:19],
		AgreeAt:          conv.MustString(SpecialTaskSettleInfo.AgreeAt, "")[0:19],
		UpdateAt:         conv.MustString(SpecialTaskSettleInfo.UpdateAt, "")[0:19],
	}
}

func SpecialTaskSettleToTaskInfo(SpecialTaskSettles []*http_model.SpecialTaskSettle) []*http_model.SpecialTaskSettleInfo {
	var SpecialTaskSettleInfos []*http_model.SpecialTaskSettleInfo
	for _, SpecialTaskSettle := range SpecialTaskSettles {
		SpecialTaskSettle := GetSpecialTaskSettleInfoStruct(SpecialTaskSettle)
		SpecialTaskSettleInfos = append(SpecialTaskSettleInfos, SpecialTaskSettle)
	}
	return SpecialTaskSettleInfos
}
