package com.usky.issue.service.sync;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 同步数据应用器路由
 *
 * @author fyc
 * @date 2026-06-29
 */
@Component
public class SyncDataApplierRegistry {

    @Autowired
    private List<SyncDataApplier> appliers;

    public void apply(Integer tenantId, String tableName, String operation, String businessPayload) throws Exception {
        for (SyncDataApplier applier : appliers) {
            if (applier.supports(tableName)) {
                applier.apply(tenantId, operation, businessPayload);
                return;
            }
        }
    }
}
