package channel

import (
	"context"

	v2 "kami/api/channel/v2"
	"kami/api/commonApi"
	"kami/internal/model"
	"kami/internal/systemV2/model/entity"
	"kami/internal/systemV2/service"
)

func (c *ControllerV2) EntranceList(ctx context.Context, req *v2.EntranceListReq) (res *v2.EntranceListRes, err error) {
	res = &v2.EntranceListRes{}
	entrance := service.Entrance()
	total, list, err := entrance.List(ctx, model.EntranceParamsInput{EntranceParamsReq: req.EntranceParamsReq})
	if err != nil {
		return res, err
	}
	res = &v2.EntranceListRes{
		CommonPageRes: commonApi.CommonPageRes[entity.V2RoadInfo]{
			Total: total,
			CommonDataRes: commonApi.CommonDataRes[entity.V2RoadInfo]{
				List: list,
			},
		},
	}
	return res, err
}
