package agency

import (
	"time"

	"bsm/full/module/ec/market/internal/models"
	pb "bsm/full/module/ec/market/pb"
)

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

	for _, in := range data {
		row := pb.MarketAgenctyItem{
			Identity:       in.Identity,
			Name:           in.Name,
			Avatar:         in.Avatar,
			Account:        in.Account,
			Phone:          in.Phone,
			OrgName:        in.OrgName,
			OrgPhoto:       in.OrgPhoto,
			IdName:         in.IDName,
			IdBefore:       in.IDBefore,
			IdAfter:        in.IDAfter,
			Remark:         in.Remark,
			CommissionRate: in.CommissionRate,
			Status:         int32(in.Status),
			CreatedAt:      in.CreatedAt.Format(time.DateTime),
			AgencyType:     int32(in.AgencyType),
			Email:          in.Email,
			Country:        in.Country,
			Area:           in.Area,
		}

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