package com.jay.monitor.data.server.config;

import com.jay.monitor.data.server.report.mysql.AvgSlowUrlTopReportInvoke;
import com.jay.monitor.data.server.report.mysql.CountUrlTopReportInvoke;
import com.jay.monitor.data.server.report.mysql.MaxSlowUrlTopReportInvoke;
import com.jay.monitor.data.server.report.mysql.UrlCountReportInvoke;
import com.jay.monitor.data.server.store.ConfigStoreManager;
import com.jay.monitor.data.server.store.mysql.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(prefix = "spring.monitor-server", name = "store-type", havingValue = "mysql", matchIfMissing = true)
public class MysqlBeanConfig {

    @Bean
    @ConditionalOnProperty(prefix = "spring.alert", value = "storeType", havingValue = "MYSQL")
    public ConfigStoreManager mysqlConfigStoreManager() {
        return new MysqlConfigStoreManager();
    }

    @Bean
    public MysqlUrlStoreProcess mysqlUrlStoreProcess() {
        return new MysqlUrlStoreProcess();
    }

    @Bean
    public MysqlDDLProcess mysqlDDLProcess() {
        return new MysqlDDLProcess();
    }

    @Bean
    public MysqlMQStoreProcess mysqlMQStoreProcess() {
        return new MysqlMQStoreProcess();
    }

    @Bean
    public MysqlSQLStoreProcess mysqlSQLStoreProcess() {
        return new MysqlSQLStoreProcess();
    }

    // 搜索类
    @Bean
    public MysqlMQSearchProcess mqSearchProcess() {
        return new MysqlMQSearchProcess();
    }

    @Bean
    public MysqlSQLSearchProcess mysqlSQLSearchProcess() {
        return new MysqlSQLSearchProcess();
    }

    @Bean
    public MysqlURLSearchProcess mysqlURLSearchProcess() {
        return new MysqlURLSearchProcess();
    }

    // 报表类
    @Bean
    public AvgSlowUrlTopReportInvoke avgSlowUrlTopReportInvoke() {
        return new AvgSlowUrlTopReportInvoke();
    }

    @Bean
    public CountUrlTopReportInvoke countUrlTopReportInvoke() {
        return new CountUrlTopReportInvoke();
    }

    @Bean
    public MaxSlowUrlTopReportInvoke maxSlowUrlTopReportInvoke() {
        return new MaxSlowUrlTopReportInvoke();
    }

    @Bean
    public UrlCountReportInvoke urlCountReportInvoke() {
        return new UrlCountReportInvoke();
    }

}
