/*
 * Tribufu API
 *
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.3.0
 * Contact: contact@tribufu.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthorizeRequest {
    #[serde(rename = "response_type", skip_serializing_if = "Option::is_none")]
    pub response_type: Option<models::ResponseType>,
    #[serde(rename = "client_id")]
    pub client_id: String,
    #[serde(rename = "code_challenge", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub code_challenge: Option<Option<String>>,
    #[serde(rename = "code_challenge_method", skip_serializing_if = "Option::is_none")]
    pub code_challenge_method: Option<models::CodeChallengeMethod>,
    #[serde(rename = "redirect_uri", deserialize_with = "Option::deserialize")]
    pub redirect_uri: Option<String>,
    #[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub scope: Option<Option<String>>,
    #[serde(rename = "state", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub state: Option<Option<String>>,
}

impl AuthorizeRequest {
    pub fn new(client_id: String, redirect_uri: Option<String>) -> AuthorizeRequest {
        AuthorizeRequest {
            response_type: None,
            client_id,
            code_challenge: None,
            code_challenge_method: None,
            redirect_uri,
            scope: None,
            state: None,
        }
    }
}

