/* 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 { TaskAggregatedStatusEnum } from './TaskAggregatedStatusEnum';
import {
    TaskAggregatedStatusEnumFromJSON,
    TaskAggregatedStatusEnumFromJSONTyped,
    TaskAggregatedStatusEnumToJSON,
    TaskAggregatedStatusEnumToJSONTyped,
} from './TaskAggregatedStatusEnum';

/**
 * Provider/source sync status
 * @export
 * @interface SyncStatus
 */
export interface SyncStatus {
    /**
     * 
     * @type {boolean}
     * @memberof SyncStatus
     */
    isRunning: boolean;
    /**
     * 
     * @type {Date}
     * @memberof SyncStatus
     */
    lastSuccessfulSync?: Date;
    /**
     * 
     * @type {TaskAggregatedStatusEnum}
     * @memberof SyncStatus
     */
    lastSyncStatus?: TaskAggregatedStatusEnum;
}



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

export function SyncStatusFromJSON(json: any): SyncStatus {
    return SyncStatusFromJSONTyped(json, false);
}

export function SyncStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): SyncStatus {
    if (json == null) {
        return json;
    }
    return {
        
        'isRunning': json['is_running'],
        'lastSuccessfulSync': json['last_successful_sync'] == null ? undefined : (new Date(json['last_successful_sync'])),
        'lastSyncStatus': json['last_sync_status'] == null ? undefined : TaskAggregatedStatusEnumFromJSON(json['last_sync_status']),
    };
}

export function SyncStatusToJSON(json: any): SyncStatus {
    return SyncStatusToJSONTyped(json, false);
}

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

    return {
        
        'is_running': value['isRunning'],
        'last_successful_sync': value['lastSuccessfulSync'] == null ? undefined : ((value['lastSuccessfulSync']).toISOString()),
        'last_sync_status': TaskAggregatedStatusEnumToJSON(value['lastSyncStatus']),
    };
}

