package com.microservices.zone.member.service.points.handler;

import com.microservices.zone.member.service.points.IPointsTaskHandler;
import com.microservices.zone.member.service.points.PointsAccountOperations;
import com.microservices.zone.member.service.points.PointsTaskContext;
import com.microservices.zone.utils.ZoneConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 会员入会审核通过 — 创建积分账户
 *
 * @author otto
 */
@Component
public class CreateAccountPointsHandler implements IPointsTaskHandler {

    @Autowired
    private PointsAccountOperations pointsAccountOperations;

    @Override
    public String getSourceType() {
        return ZoneConstants.MemberAudit.SOURCE_TYPE;
    }

    @Override
    public void handle(PointsTaskContext ctx) {
        pointsAccountOperations.createPointsAccountTask(ctx.getUserId(), ctx.getZoneId(), ctx.getOperatorId());
    }
}
