package com.sino.mci.channel.wecom.archive;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 企微会话存档 Finance SDK 客户端自动配置。
 *
 * <p>默认注入 {@link MockFinanceSdkClient}；设置 {@code sino.channel.wecom.finance-sdk.native=true}
 * 可切换为 {@link NativeFinanceSdkClient}（需自行完成 JNI 接入）。</p>
 */
@Configuration
public class FinanceSdkAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(FinanceSdkClient.class)
    @ConditionalOnProperty(name = "sino.channel.wecom.finance-sdk.native", havingValue = "true")
    public FinanceSdkClient nativeFinanceSdkClient() {
        return new NativeFinanceSdkClient();
    }

    @Bean
    @ConditionalOnMissingBean(FinanceSdkClient.class)
    public FinanceSdkClient mockFinanceSdkClient() {
        return new MockFinanceSdkClient();
    }
}
