package road_pool

import (
	"context"

	"kami/api/commonApi"
	"kami/api/road_pool/v1"
	"kami/internal/service"
)

func (c *ControllerV1) SimpleAllGetRoad(ctx context.Context, req *v1.SimpleAllGetRoadReq) (res *v1.SimpleAllGetRoadRes, err error) {
	s := service.RoadPool()
	list, err := s.GetSimpleAll(ctx)

	tmpResList := make([]v1.RoadPoolSimpleInfo, 0)
	for _, v := range list {
		tmpResList = append(tmpResList, v.RoadPoolSimpleInfo)
	}

	res = &v1.SimpleAllGetRoadRes{
		CommonDataRes: commonApi.CommonDataRes[v1.RoadPoolSimpleInfo]{
			List: tmpResList,
		},
	}
	return
}
