/* tslint:disable */
/* eslint-disable */
/**
 * OpenAPI Petstore
 * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import {ApiRecordUtils, knownRecordFactories} from "../runtimeSagasAndRecords";
import {getApiEntitiesState} from "../ApiEntitiesSelectors"
import {List, Record, RecordOf, Map} from 'immutable';
import {Schema, schema, NormalizedSchema} from "normalizr";
import {select, call} from "redux-saga/effects";

import {
    Part,
} from './Part';



export const PartRecordProps = {
    recType: "PartApiRecord" as "PartApiRecord",
    id: "-1",
    name: "",
};

export type PartRecordPropsType = typeof PartRecordProps;
export const PartRecord = Record(PartRecordProps, PartRecordProps.recType);
export type PartRecord = RecordOf<PartRecordPropsType>;

knownRecordFactories.set(PartRecordProps.recType, PartRecord);


class PartRecordUtils extends ApiRecordUtils<Part, PartRecord> {
    public normalize(apiObject: Part, asEntity?: boolean): Part {
        (apiObject as any).recType = PartRecordProps.recType;
        (apiObject as any).id = apiObject.id.toString();
        return apiObject;
    }

    public toApi(record: PartRecord): Part {
        const apiObject = super.toApi(record);
        apiObject.id = parseFloat(record.id);
        return apiObject;
    }
}

export const partRecordUtils = new PartRecordUtils();


