import AbstractWorker from "../../../tradingbot/worker/AbstractWorker.js";
import AbstractConverter from "../AbstractConverter.js";
import ConverterFactory from "../ConverterFactory.js";

export default class WorkerConverter extends AbstractConverter {

    constructor(){
        super();
    }

    /**
     * @param {AbstractWorker} obj
     * @returns {object} 
     */
    toRestObject(obj) {
        return {
            _objectType: ConverterFactory.OBJECT_TYPE_ABSTRACT_WORKER,
            id: obj.getId(),
            name: obj.getName(),
            symbol: obj.getTradingPair().getKey(),
            strategy: obj.getStrategy().constructor.name
        };
    }

    /**
     * @param {object} obj
     * @returns {AbstractWorker} 
     */
    fromRestObject(obj) {
        return null;
    }
}