/* tslint:disable */
/* eslint-disable */
/**
 * Tribufu API
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.3.0
 * Contact: contact@tribufu.com
 *
 * 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 { StorageFile } from './StorageFile';
import {
    StorageFileFromJSON,
    StorageFileFromJSONTyped,
    StorageFileToJSON,
    StorageFileToJSONTyped,
} from './StorageFile';

/**
 * 
 * @export
 * @interface PackageRelease
 */
export interface PackageRelease {
    /**
     * 
     * @type {string}
     * @memberof PackageRelease
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof PackageRelease
     */
    version: string | null;
    /**
     * 
     * @type {string}
     * @memberof PackageRelease
     */
    packageId?: string;
    /**
     * 
     * @type {string}
     * @memberof PackageRelease
     */
    notes?: string | null;
    /**
     * 
     * @type {Array<StorageFile>}
     * @memberof PackageRelease
     */
    readonly files?: Array<StorageFile> | null;
    /**
     * 
     * @type {Date}
     * @memberof PackageRelease
     */
    created?: Date;
    /**
     * 
     * @type {Date}
     * @memberof PackageRelease
     */
    updated?: Date | null;
}

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

export function PackageReleaseFromJSON(json: any): PackageRelease {
    return PackageReleaseFromJSONTyped(json, false);
}

export function PackageReleaseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PackageRelease {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'] == null ? undefined : json['id'],
        'version': json['version'],
        'packageId': json['package_id'] == null ? undefined : json['package_id'],
        'notes': json['notes'] == null ? undefined : json['notes'],
        'files': json['files'] == null ? undefined : ((json['files'] as Array<any>).map(StorageFileFromJSON)),
        'created': json['created'] == null ? undefined : (new Date(json['created'])),
        'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
    };
}

export function PackageReleaseToJSON(json: any): PackageRelease {
    return PackageReleaseToJSONTyped(json, false);
}

export function PackageReleaseToJSONTyped(value?: Omit<PackageRelease, 'files'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'id': value['id'],
        'version': value['version'],
        'package_id': value['packageId'],
        'notes': value['notes'],
        'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
        'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
    };
}

