/* tslint:disable */
/* eslint-disable */
/**
 * AskNews API
 * AskNews API [![status](https://status.asknews.app/api/badge/2/status?style=for-the-badge)](https://status.asknews.app/status/prod)
 *
 * The version of the OpenAPI document: 0.24.66
 * Contact: contact@emergentmethods.ai
 *
 * 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 { UserProfileOrganization } from './UserProfileOrganization';
import {
    UserProfileOrganizationFromJSON,
    UserProfileOrganizationFromJSONTyped,
    UserProfileOrganizationToJSON,
    UserProfileOrganizationToJSONTyped,
} from './UserProfileOrganization';
import type { UserProfileSubscription } from './UserProfileSubscription';
import {
    UserProfileSubscriptionFromJSON,
    UserProfileSubscriptionFromJSONTyped,
    UserProfileSubscriptionToJSON,
    UserProfileSubscriptionToJSONTyped,
} from './UserProfileSubscription';

/**
 * 
 * @export
 * @interface UserProfile
 */
export interface UserProfile {
    /**
     * 
     * @type {string}
     * @memberof UserProfile
     */
    identityType?: UserProfileIdentityTypeEnum;
    /**
     * 
     * @type {string}
     * @memberof UserProfile
     */
    id: string;
    /**
     * 
     * @type {UserProfileSubscription}
     * @memberof UserProfile
     */
    subscription: UserProfileSubscription;
    /**
     * 
     * @type {UserProfileOrganization}
     * @memberof UserProfile
     */
    organization?: UserProfileOrganization | null;
    /**
     * 
     * @type {boolean}
     * @memberof UserProfile
     */
    suspended?: boolean;
}


/**
 * @export
 */
export const UserProfileIdentityTypeEnum = {
    User: 'user'
} as const;
export type UserProfileIdentityTypeEnum = typeof UserProfileIdentityTypeEnum[keyof typeof UserProfileIdentityTypeEnum];


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

export function UserProfileFromJSON(json: any): UserProfile {
    return UserProfileFromJSONTyped(json, false);
}

export function UserProfileFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserProfile {
    if (json == null) {
        return json;
    }
    return {
        
        'identityType': json['identity_type'] == null ? undefined : json['identity_type'],
        'id': json['id'],
        'subscription': UserProfileSubscriptionFromJSON(json['subscription']),
        'organization': json['organization'] == null ? undefined : UserProfileOrganizationFromJSON(json['organization']),
        'suspended': json['suspended'] == null ? undefined : json['suspended'],
    };
}

export function UserProfileToJSON(json: any): UserProfile {
    return UserProfileToJSONTyped(json, false);
}

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

    return {
        
        'identity_type': value['identityType'],
        'id': value['id'],
        'subscription': UserProfileSubscriptionToJSON(value['subscription']),
        'organization': UserProfileOrganizationToJSON(value['organization']),
        'suspended': value['suspended'],
    };
}

