/* tslint:disable */
/* eslint-disable */
/**
 * Ringer Business API
 * This API provides comprehensive endpoints for the Ringer Business system. It includes functionality for managing customer accounts, addresses, sites,  phone numbers, payments, users, and other business resources.  Operations typically require authentication and appropriate permissions. 
 *
 * The version of the OpenAPI document: 1.0.5
 * Contact: support@ringer.tel
 *
 * 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 { SchemasLink } from './SchemasLink';
import {
    SchemasLinkFromJSON,
    SchemasLinkFromJSONTyped,
    SchemasLinkToJSON,
    SchemasLinkToJSONTyped,
} from './SchemasLink';
import type { CallRecord } from './CallRecord';
import {
    CallRecordFromJSON,
    CallRecordFromJSONTyped,
    CallRecordToJSON,
    CallRecordToJSONTyped,
} from './CallRecord';

/**
 * A paginated list of call records.
 * @export
 * @interface CallRecordListResponse
 */
export interface CallRecordListResponse {
    /**
     * 
     * @type {Array<CallRecord>}
     * @memberof CallRecordListResponse
     */
    callRecords: Array<CallRecord>;
    /**
     * Total number of records matching the query.
     * @type {number}
     * @memberof CallRecordListResponse
     */
    totalItems?: number;
    /**
     * Total number of pages based on page_size.
     * @type {number}
     * @memberof CallRecordListResponse
     */
    totalPages?: number;
    /**
     * The current page number.
     * @type {number}
     * @memberof CallRecordListResponse
     */
    currentPage?: number;
    /**
     * Number of records per page.
     * @type {number}
     * @memberof CallRecordListResponse
     */
    perPage?: number;
    /**
     * 
     * @type {Array<SchemasLink>}
     * @memberof CallRecordListResponse
     */
    links?: Array<SchemasLink> | null;
}

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

export function CallRecordListResponseFromJSON(json: any): CallRecordListResponse {
    return CallRecordListResponseFromJSONTyped(json, false);
}

export function CallRecordListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CallRecordListResponse {
    if (json == null) {
        return json;
    }
    return {
        
        'callRecords': ((json['call_records'] as Array<any>).map(CallRecordFromJSON)),
        'totalItems': json['total_items'] == null ? undefined : json['total_items'],
        'totalPages': json['total_pages'] == null ? undefined : json['total_pages'],
        'currentPage': json['current_page'] == null ? undefined : json['current_page'],
        'perPage': json['per_page'] == null ? undefined : json['per_page'],
        'links': json['links'] == null ? undefined : ((json['links'] as Array<any>).map(SchemasLinkFromJSON)),
    };
}

export function CallRecordListResponseToJSON(json: any): CallRecordListResponse {
    return CallRecordListResponseToJSONTyped(json, false);
}

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

    return {
        
        'call_records': ((value['callRecords'] as Array<any>).map(CallRecordToJSON)),
        'total_items': value['totalItems'],
        'total_pages': value['totalPages'],
        'current_page': value['currentPage'],
        'per_page': value['perPage'],
        'links': value['links'] == null ? undefined : ((value['links'] as Array<any>).map(SchemasLinkToJSON)),
    };
}

