/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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 SourceRequest
 */
export interface SourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof SourceRequest
     */
    name: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof SourceRequest
     */
    slug: string;
    /**
     * 
     * @type {boolean}
     * @memberof SourceRequest
     */
    enabled?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof SourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof SourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof SourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     * 
     * @type {Array<string>}
     * @memberof SourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof SourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof SourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     * 
     * @type {string}
     * @memberof SourceRequest
     */
    userPathTemplate?: string;
}



/**
 * Check if a given object implements the SourceRequest interface.
 */
export function instanceOfSourceRequest(value: object): value is SourceRequest {
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('slug' in value) || value['slug'] === undefined) return false;
    return true;
}

export function SourceRequestFromJSON(json: any): SourceRequest {
    return SourceRequestFromJSONTyped(json, false);
}

export function SourceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SourceRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'name': json['name'],
        'slug': 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'],
    };
}

export function SourceRequestToJSON(json: any): SourceRequest {
    return SourceRequestToJSONTyped(json, false);
}

export function SourceRequestToJSONTyped(value?: SourceRequest | 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'],
    };
}

