// Path: src/main/java/org/dmfs/oauth2/client/pkce/PkceCodeChallenge.java
// public interface PkceCodeChallenge
// {
//     /**
//      * Returns a {@link Token} that identifies the method this code challenge uses.
//      *
//      * @return A {@link Token} containing the method name.
//      */
//     Token method();
// 
//     /**
//      * Returns the value of the code challenge.
//      *
//      * @return
//      */
//     CharSequence challenge();
// }
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> CLIENT_ID = new BasicParameterType<>("client_id", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> CODE_CHALLENGE = new BasicParameterType<>("code_challenge", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> CODE_CHALLENGE_METHOD = new BasicParameterType<>("code_challenge_method", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<Uri> REDIRECT_URI = new BasicParameterType<>("redirect_uri", new UriValueType());
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> RESPONSE_TYPE = new BasicParameterType<>("response_type", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<OAuth2Scope> SCOPE = new BasicParameterType<OAuth2Scope>("scope", new OAuth2ScopeValueType());
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> STATE = new BasicParameterType<>("state", TextValueType.INSTANCE);


import static org.dmfs.oauth2.client.utils.Parameters.CODE_CHALLENGE_METHOD;
import static org.dmfs.oauth2.client.utils.Parameters.REDIRECT_URI;
import static org.dmfs.oauth2.client.utils.Parameters.RESPONSE_TYPE;
import static org.dmfs.oauth2.client.utils.Parameters.SCOPE;
import static org.dmfs.oauth2.client.utils.Parameters.STATE;
import org.dmfs.oauth2.client.pkce.PkceCodeChallenge;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.encoding.XWwwFormUrlEncoded;
import org.dmfs.rfc3986.parameters.FluentParameterList;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.parametersets.BasicParameterList;
import org.dmfs.rfc3986.parameters.parametersets.Fluent;
import org.dmfs.rfc3986.parameters.parametersets.Replacing;
import java.net.URI;
import java.net.URISyntaxException;
import static org.dmfs.oauth2.client.utils.Parameters.CLIENT_ID;
import static org.dmfs.oauth2.client.utils.Parameters.CODE_CHALLENGE;
/*
 * Copyright 2016 dmfs GmbH
 *
 * Licensed 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.dmfs.oauth2.client;





/**
 * A basic {@link OAuth2AuthorizationRequest} implementation.
 * <p>
 * Note: Usually you don't need to instantiate this directly.
 *
 * @author Marten Gajda
 */
public final class BasicOAuth2AuthorizationRequest implements OAuth2AuthorizationRequest
{
    private final FluentParameterList mParameters;


    public BasicOAuth2AuthorizationRequest(String responseType, CharSequence state)
    {
        this(new Fluent(new BasicParameterList(RESPONSE_TYPE.parameter(responseType), STATE.parameter(state))));
    }


    public BasicOAuth2AuthorizationRequest(String responseType, CharSequence state, ParameterList customParameters)
    {
        this(new Fluent(new Replacing(customParameters, RESPONSE_TYPE.parameter(responseType), STATE.parameter(state))));
    }


    public BasicOAuth2AuthorizationRequest(String responseType, OAuth2Scope scope, CharSequence state)
    {
// Path: src/main/java/org/dmfs/oauth2/client/pkce/PkceCodeChallenge.java
// public interface PkceCodeChallenge
// {
//     /**
//      * Returns a {@link Token} that identifies the method this code challenge uses.
//      *
//      * @return A {@link Token} containing the method name.
//      */
//     Token method();
// 
//     /**
//      * Returns the value of the code challenge.
//      *
//      * @return
//      */
//     CharSequence challenge();
// }
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> CLIENT_ID = new BasicParameterType<>("client_id", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> CODE_CHALLENGE = new BasicParameterType<>("code_challenge", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> CODE_CHALLENGE_METHOD = new BasicParameterType<>("code_challenge_method", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<Uri> REDIRECT_URI = new BasicParameterType<>("redirect_uri", new UriValueType());
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> RESPONSE_TYPE = new BasicParameterType<>("response_type", TextValueType.INSTANCE);
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<OAuth2Scope> SCOPE = new BasicParameterType<OAuth2Scope>("scope", new OAuth2ScopeValueType());
// 
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> STATE = new BasicParameterType<>("state", TextValueType.INSTANCE);


// Path: src/main/java/org/dmfs/oauth2/client/BasicOAuth2AuthorizationRequest.java
import static org.dmfs.oauth2.client.utils.Parameters.CODE_CHALLENGE_METHOD;
import static org.dmfs.oauth2.client.utils.Parameters.REDIRECT_URI;
import static org.dmfs.oauth2.client.utils.Parameters.RESPONSE_TYPE;
import static org.dmfs.oauth2.client.utils.Parameters.SCOPE;
import static org.dmfs.oauth2.client.utils.Parameters.STATE;
import org.dmfs.oauth2.client.pkce.PkceCodeChallenge;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.encoding.XWwwFormUrlEncoded;
import org.dmfs.rfc3986.parameters.FluentParameterList;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.parametersets.BasicParameterList;
import org.dmfs.rfc3986.parameters.parametersets.Fluent;
import org.dmfs.rfc3986.parameters.parametersets.Replacing;
import java.net.URI;
import java.net.URISyntaxException;
import static org.dmfs.oauth2.client.utils.Parameters.CLIENT_ID;
import static org.dmfs.oauth2.client.utils.Parameters.CODE_CHALLENGE;

/*
 * Copyright 2016 dmfs GmbH
 *
 * Licensed 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.dmfs.oauth2.client;





/**
 * A basic {@link OAuth2AuthorizationRequest} implementation.
 * <p>
 * Note: Usually you don't need to instantiate this directly.
 *
 * @author Marten Gajda
 */
public final class BasicOAuth2AuthorizationRequest implements OAuth2AuthorizationRequest
{
    private final FluentParameterList mParameters;


    public BasicOAuth2AuthorizationRequest(String responseType, CharSequence state)
    {
        this(new Fluent(new BasicParameterList(RESPONSE_TYPE.parameter(responseType), STATE.parameter(state))));
    }


    public BasicOAuth2AuthorizationRequest(String responseType, CharSequence state, ParameterList customParameters)
    {
        this(new Fluent(new Replacing(customParameters, RESPONSE_TYPE.parameter(responseType), STATE.parameter(state))));
    }


    public BasicOAuth2AuthorizationRequest(String responseType, OAuth2Scope scope, CharSequence state)
    {
        this(new Fluent(new BasicParameterList(RESPONSE_TYPE.parameter(responseType), SCOPE.parameter(scope), STATE.parameter(state))));