/*
 * Copyright 2016 LINE Corporation
 *
 * LINE Corporation 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 com.linecorp.bot.spring.boot;

import java.net.URI;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

import com.linecorp.bot.client.LineClientConstants;
import com.linecorp.bot.spring.boot.BotPropertiesValidator.ValidBotProperties;
import com.linecorp.bot.spring.boot.annotation.EventMapping;
import com.linecorp.bot.spring.boot.annotation.LineMessageHandler;

import lombok.Data;

@Data
@Validated
@ValidBotProperties
@ConfigurationProperties(prefix = "line.bot")
public class LineBotProperties {
    /**
     * Channel token supply mode.
     *
     * @see ChannelTokenSupplyMode
     */
    @NotNull
    private ChannelTokenSupplyMode channelTokenSupplyMode = ChannelTokenSupplyMode.FIXED;

    /**
     * Channel acccess token.
     */
    @Valid
    private String channelToken = "OD6ub5Qyystuid9ouEmNPBRLFmQTyeAbEX9ngG3WB9Scma4cDIM5qanrZ5dmJgnoKPxGwMQlsyDC8jm3p7LMLinTKRJDuMBrJ4ACM0egQIppZBoCGtCYA0rgBp8PSb8EkJppGlP0BhaWFVaeiyQddwdB04t89";

    /**
     * Channel secret.
     */
    @Valid
    @NotNull
    private String channelSecret = "8f928619348271540a75f7bd171bd4a6";

    @Valid
    @NotNull
    private String apiEndPoint = LineClientConstants.DEFAULT_API_END_POINT;

    /**
     * Connection timeout in milliseconds.
     */
    @Valid
    @NotNull
    private long connectTimeout = LineClientConstants.DEFAULT_CONNECT_TIMEOUT_MILLIS;

    /**
     * Read timeout in milliseconds.
     */
    @Valid
    @NotNull
    private long readTimeout = LineClientConstants.DEFAULT_READ_TIMEOUT_MILLIS;

    /**
     * Write timeout in milliseconds.
     */
    @Valid
    @NotNull
    private long writeTimeout = LineClientConstants.DEFAULT_WRITE_TIMEOUT_MILLIS;

    /**
     * Configuration for {@link LineMessageHandler} and {@link EventMapping}.
     */
    @Valid
    @NotNull
    private Handler handler = new Handler();

    @Data
    public static class Handler {
        /**
         * Flag to enable/disable {@link LineMessageHandler} and {@link EventMapping}.
         *
         * <p>Default: {@code true}
         */
        boolean enabled = true;

        /**
         * REST endpoint path of dispatcher.
         */
        @NotNull
        URI path = URI.create("/callback");
    }

    public enum ChannelTokenSupplyMode {
        /**
         * Use fixed channel token for public API user.
         */
        FIXED,

        /**
         * Supply channel token via channel token supplier for specific business partners.
         *
         * @see <a href="https://devdocs.line.me/#issue-channel-access-token"
         *         >//devdocs.line.me/#issue-channel-access-token</a>
         */
        SUPPLIER,
    }
}

@@ -1639,16 +1639,33 @@
 ma4cDIM5
+%22%0A            + %22
 qanrZ5dm
@@ -1701,16 +1701,33 @@
 RJDuMBrJ
+%22%0A            + %22
 4ACM0egQ
@@ -2783,32 +2783,43 @@
 sageHandler%7D and
+%0A         *
  %7B@link EventMap
@@ -2827,32 +2827,36 @@
 ing%7D.%0A         *
+ %3Cp%3E
 %0A         * %3Cp%3ED
@@ -2851,19 +2851,16 @@
       * 
-%3Cp%3E
 Default:
@@ -3284,16 +3284,27 @@
 business
+%0A         *
  partner
@@ -3405,19 +3405,16 @@
        *
-   
       %3E/

failed -3