/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.shardingsphere.sharding.algorithm.config;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;

/**
 * Algorithm provided sharding rule configuration.
 */
@Getter
@Setter
public final class AlgorithmProvidedShardingRuleConfiguration implements RuleConfiguration {
    
    private Collection<ShardingTableRuleConfiguration> tables = new LinkedList<>();
    
    private Collection<ShardingAutoTableRuleConfiguration> autoTables = new LinkedList<>();
    
    private Collection<String> bindingTableGroups = new LinkedList<>();
    
    private Collection<String> broadcastTables = new LinkedList<>();
    
    private ShardingStrategyConfiguration defaultDatabaseShardingStrategy;
    
    private ShardingStrategyConfiguration defaultTableShardingStrategy;
    
    private KeyGenerateStrategyConfiguration defaultKeyGenerateStrategy;
    
    private Map<String, ShardingAlgorithm> shardingAlgorithms = new LinkedHashMap<>();
    
    private Map<String, KeyGenerateAlgorithm> keyGenerators = new LinkedHashMap<>();
    
    public AlgorithmProvidedShardingRuleConfiguration() {
    }
    
    public AlgorithmProvidedShardingRuleConfiguration(final Collection<ShardingTableRuleConfiguration> tables,
                                                      final Collection<ShardingAutoTableRuleConfiguration> autoTables,
                                                      final Collection<String> bindingTableGroups,
                                                      final Collection<String> broadcastTables,
                                                      final ShardingStrategyConfiguration defaultDatabaseShardingStrategy,
                                                      final ShardingStrategyConfiguration defaultTableShardingStrategy,
                                                      final KeyGenerateStrategyConfiguration defaultKeyGenerateStrategy,
                                                      final Map<String, ShardingAlgorithm> shardingAlgorithms,
                                                      final Map<String, KeyGenerateAlgorithm> keyGenerators) {
        this.tables = tables;
        this.autoTables = autoTables;
        this.bindingTableGroups = bindingTableGroups;
        this.broadcastTables = broadcastTables;
        this.defaultDatabaseShardingStrategy = defaultDatabaseShardingStrategy;
        this.defaultTableShardingStrategy = defaultTableShardingStrategy;
        this.defaultKeyGenerateStrategy = defaultKeyGenerateStrategy;
        this.shardingAlgorithms = shardingAlgorithms;
        this.keyGenerators = keyGenerators;
    }
}

@@ -869,132 +869,87 @@
 ort 
-java.util.Collection;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.LinkedList;%0Aimport java.util.Map;%0Aimport lombok.Gette
+lombok.AllArgsConstructor;%0Aimport lombok.Getter;%0Aimport lombok.NoArgsConstructo
 r;%0Ai
@@ -1557,16 +1557,129 @@
 rithm;%0A%0A
+import java.util.Collection;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.LinkedList;%0Aimport java.util.Map;%0A%0A
 /**%0A * A
@@ -1729,16 +1729,55 @@
 on.%0A */%0A
+@NoArgsConstructor%0A@AllArgsConstructor%0A
 @Getter%0A
@@ -2635,1589 +2635,6 @@
 ();%0A
-    %0A    public AlgorithmProvidedShardingRuleConfiguration() %7B%0A    %7D%0A    %0A    public AlgorithmProvidedShardingRuleConfiguration(final Collection%3CShardingTableRuleConfiguration%3E tables,%0A                                                      final Collection%3CShardingAutoTableRuleConfiguration%3E autoTables,%0A                                                      final Collection%3CString%3E bindingTableGroups,%0A                                                      final Collection%3CString%3E broadcastTables,%0A                                                      final ShardingStrategyConfiguration defaultDatabaseShardingStrategy,%0A                                                      final ShardingStrategyConfiguration defaultTableShardingStrategy,%0A                                                      final KeyGenerateStrategyConfiguration defaultKeyGenerateStrategy,%0A                                                      final Map%3CString, ShardingAlgorithm%3E shardingAlgorithms,%0A                                                      final Map%3CString, KeyGenerateAlgorithm%3E keyGenerators) %7B%0A        this.tables = tables;%0A        this.autoTables = autoTables;%0A        this.bindingTableGroups = bindingTableGroups;%0A        this.broadcastTables = broadcastTables;%0A        this.defaultDatabaseShardingStrategy = defaultDatabaseShardingStrategy;%0A        this.defaultTableShardingStrategy = defaultTableShardingStrategy;%0A        this.defaultKeyGenerateStrategy = defaultKeyGenerateStrategy;%0A        this.shardingAlgorithms = shardingAlgorithms;%0A        this.keyGenerators = keyGenerators;%0A    %7D%0A
 %7D%0A

Simplify AlgorithmProvidedShardingRuleConfiguration (#7700)