/* 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';
import type { GroupMatchingModeEnum } from './GroupMatchingModeEnum';
import {
    GroupMatchingModeEnumFromJSON,
    GroupMatchingModeEnumFromJSONTyped,
    GroupMatchingModeEnumToJSON,
    GroupMatchingModeEnumToJSONTyped,
} from './GroupMatchingModeEnum';

/**
 * Plex Source Serializer
 * @export
 * @interface PatchedPlexSourceRequest
 */
export interface PatchedPlexSourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    name?: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    slug?: string;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedPlexSourceRequest
     */
    enabled?: boolean;
    /**
     * When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
     * @type {boolean}
     * @memberof PatchedPlexSourceRequest
     */
    promoted?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof PatchedPlexSourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     * 
     * @type {Array<string>}
     * @memberof PatchedPlexSourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof PatchedPlexSourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof PatchedPlexSourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     * 
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    userPathTemplate?: string;
    /**
     * How the source determines if an existing group should be used or a new group created.
     * @type {GroupMatchingModeEnum}
     * @memberof PatchedPlexSourceRequest
     */
    groupMatchingMode?: GroupMatchingModeEnum;
    /**
     * Client identifier used to talk to Plex.
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    clientId?: string;
    /**
     * Which servers a user has to be a member of to be granted access. Empty list allows every server.
     * @type {Array<string>}
     * @memberof PatchedPlexSourceRequest
     */
    allowedServers?: Array<string>;
    /**
     * Allow friends to authenticate, even if you don't share a server.
     * @type {boolean}
     * @memberof PatchedPlexSourceRequest
     */
    allowFriends?: boolean;
    /**
     * Plex token used to check friends
     * @type {string}
     * @memberof PatchedPlexSourceRequest
     */
    plexToken?: string;
}



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

export function PatchedPlexSourceRequestFromJSON(json: any): PatchedPlexSourceRequest {
    return PatchedPlexSourceRequestFromJSONTyped(json, false);
}

export function PatchedPlexSourceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedPlexSourceRequest {
    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'],
        'promoted': json['promoted'] == null ? undefined : json['promoted'],
        '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'],
        'groupMatchingMode': json['group_matching_mode'] == null ? undefined : GroupMatchingModeEnumFromJSON(json['group_matching_mode']),
        'clientId': json['client_id'] == null ? undefined : json['client_id'],
        'allowedServers': json['allowed_servers'] == null ? undefined : json['allowed_servers'],
        'allowFriends': json['allow_friends'] == null ? undefined : json['allow_friends'],
        'plexToken': json['plex_token'] == null ? undefined : json['plex_token'],
    };
}

export function PatchedPlexSourceRequestToJSON(json: any): PatchedPlexSourceRequest {
    return PatchedPlexSourceRequestToJSONTyped(json, false);
}

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

    return {
        
        'name': value['name'],
        'slug': value['slug'],
        'enabled': value['enabled'],
        'promoted': value['promoted'],
        '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'],
        'group_matching_mode': GroupMatchingModeEnumToJSON(value['groupMatchingMode']),
        'client_id': value['clientId'],
        'allowed_servers': value['allowedServers'],
        'allow_friends': value['allowFriends'],
        'plex_token': value['plexToken'],
    };
}

