/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.12.0-rc1
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { mapValues } from '../runtime';
import type { PolicyEngineMode } from './PolicyEngineMode';
import {
    PolicyEngineModeFromJSON,
    PolicyEngineModeFromJSONTyped,
    PolicyEngineModeToJSON,
    PolicyEngineModeToJSONTyped,
} from './PolicyEngineMode';
import type { UserMatchingModeEnum } from './UserMatchingModeEnum';
import {
    UserMatchingModeEnumFromJSON,
    UserMatchingModeEnumFromJSONTyped,
    UserMatchingModeEnumToJSON,
    UserMatchingModeEnumToJSONTyped,
} from './UserMatchingModeEnum';

/**
 * Source Serializer
 * @export
 * @interface PatchedTelegramSourceRequest
 */
export interface PatchedTelegramSourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    name?: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    slug?: string;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedTelegramSourceRequest
     */
    enabled?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof PatchedTelegramSourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     * 
     * @type {Array<string>}
     * @memberof PatchedTelegramSourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof PatchedTelegramSourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof PatchedTelegramSourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     * 
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    userPathTemplate?: string;
    /**
     * Telegram bot username
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    botUsername?: string;
    /**
     * Telegram bot token
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    botToken?: string;
    /**
     * Request access to send messages from your bot.
     * @type {boolean}
     * @memberof PatchedTelegramSourceRequest
     */
    requestMessageAccess?: boolean;
    /**
     * Flow used before authentication.
     * @type {string}
     * @memberof PatchedTelegramSourceRequest
     */
    preAuthenticationFlow?: string;
}



/**
 * Check if a given object implements the PatchedTelegramSourceRequest interface.
 */
export function instanceOfPatchedTelegramSourceRequest(value: object): value is PatchedTelegramSourceRequest {
    return true;
}

export function PatchedTelegramSourceRequestFromJSON(json: any): PatchedTelegramSourceRequest {
    return PatchedTelegramSourceRequestFromJSONTyped(json, false);
}

export function PatchedTelegramSourceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedTelegramSourceRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'name': json['name'] == null ? undefined : json['name'],
        'slug': json['slug'] == null ? undefined : json['slug'],
        'enabled': json['enabled'] == null ? undefined : json['enabled'],
        'authenticationFlow': json['authentication_flow'] == null ? undefined : json['authentication_flow'],
        'enrollmentFlow': json['enrollment_flow'] == null ? undefined : json['enrollment_flow'],
        'userPropertyMappings': json['user_property_mappings'] == null ? undefined : json['user_property_mappings'],
        'groupPropertyMappings': json['group_property_mappings'] == null ? undefined : json['group_property_mappings'],
        'policyEngineMode': json['policy_engine_mode'] == null ? undefined : PolicyEngineModeFromJSON(json['policy_engine_mode']),
        'userMatchingMode': json['user_matching_mode'] == null ? undefined : UserMatchingModeEnumFromJSON(json['user_matching_mode']),
        'userPathTemplate': json['user_path_template'] == null ? undefined : json['user_path_template'],
        'botUsername': json['bot_username'] == null ? undefined : json['bot_username'],
        'botToken': json['bot_token'] == null ? undefined : json['bot_token'],
        'requestMessageAccess': json['request_message_access'] == null ? undefined : json['request_message_access'],
        'preAuthenticationFlow': json['pre_authentication_flow'] == null ? undefined : json['pre_authentication_flow'],
    };
}

export function PatchedTelegramSourceRequestToJSON(json: any): PatchedTelegramSourceRequest {
    return PatchedTelegramSourceRequestToJSONTyped(json, false);
}

export function PatchedTelegramSourceRequestToJSONTyped(value?: PatchedTelegramSourceRequest | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'slug': value['slug'],
        'enabled': value['enabled'],
        'authentication_flow': value['authenticationFlow'],
        'enrollment_flow': value['enrollmentFlow'],
        'user_property_mappings': value['userPropertyMappings'],
        'group_property_mappings': value['groupPropertyMappings'],
        'policy_engine_mode': PolicyEngineModeToJSON(value['policyEngineMode']),
        'user_matching_mode': UserMatchingModeEnumToJSON(value['userMatchingMode']),
        'user_path_template': value['userPathTemplate'],
        'bot_username': value['botUsername'],
        'bot_token': value['botToken'],
        'request_message_access': value['requestMessageAccess'],
        'pre_authentication_flow': value['preAuthenticationFlow'],
    };
}

