package ads

import (
	"bsm/full/module/ec/mall/internal/models"
	pb "bsm/full/module/ec/mall/pb"
	"git.apinb.com/bsm-sdk/core/vars"
)

func ref(data []*models.MallAds) (list []*pb.AdsItem) {
	if len(data) == 0 {
		return
	}

	for _, in := range data {
		row := pb.AdsItem{
			Id:        int64(in.ID),
			Title:     in.Title,
			PosKey:    in.PosKey,
			Content:   in.Content,
			Type:      int32(in.Type),
			ToUrl:     in.ToUrl,
			CreatedAt: in.CreatedAt.Format(vars.YYYY_MM_DD_HH_MM_SS),
		}

		list = append(list, &row)
	}
	return
}
