package restriction

import (
	"context"
	"kami/internal/consts"
	"kami/internal/service"

	"kami/api/restriction/v1"
)

func (c *ControllerV1) BlockOrder(ctx context.Context, req *v1.BlockOrderReq) (res *v1.BlockOrderRes, err error) {
	var status consts.RestrictStatus
	switch req.BlockStatus {
	case consts.RestrictStatus_Disable:
		status = consts.RestrictStatus_Enable
	case consts.RestrictStatus_Enable:
		status = consts.RestrictStatus_Disable
	}
	_ = service.Restriction().SetCurrentOrderDisable(ctx, req.OrderNo, status, nil)
	return
}
