package staff

import (
	"time"

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

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

	for _, in := range data {
		row := pb.StaffItem{
			Identity:  in.Identity,
			Name:      in.Name,
			Account:   in.Account,
			Password:  "***",
			Profile:   in.Profile,
			Phone:     in.Phone,
			Email:     in.Email,
			Avatar:    in.Avatar,
			Role:      "staff",
			CreatedAt: in.CreatedAt.Format(time.DateTime),
		}

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