package activity

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	"server/api/activity/v1"
)

func (c *ControllerV1) RuleList(ctx context.Context, req *v1.RuleListReq) (res *v1.RuleListRes, err error) {
	out, err := service.SignInRewardRules().List(ctx, &model.SignInRewardRulesListIn{
		Page:     req.Page,
		RuleName: req.RuleName,
		Size:     req.Size,
		Status:   req.Status,
	})
	if err != nil {
		return nil, err
	}
	return &v1.RuleListRes{
		Total: out.Total,
		List:  out.List,
	}, nil
}
