// Auto-generated. Do not edit!

// (in-package franka_msgs_archemist.msg)


"use strict";

const _serializer = _ros_msg_utils.Serialize;
const _arraySerializer = _serializer.Array;
const _deserializer = _ros_msg_utils.Deserialize;
const _arrayDeserializer = _deserializer.Array;
const _finder = _ros_msg_utils.Find;
const _getByteLength = _ros_msg_utils.getByteLength;

//-----------------------------------------------------------

class PandaTask {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.task_seq = null;
      this.task_name = null;
      this.task_parameters = null;
    }
    else {
      if (initObj.hasOwnProperty('task_seq')) {
        this.task_seq = initObj.task_seq
      }
      else {
        this.task_seq = 0;
      }
      if (initObj.hasOwnProperty('task_name')) {
        this.task_name = initObj.task_name
      }
      else {
        this.task_name = '';
      }
      if (initObj.hasOwnProperty('task_parameters')) {
        this.task_parameters = initObj.task_parameters
      }
      else {
        this.task_parameters = [];
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type PandaTask
    // Serialize message field [task_seq]
    bufferOffset = _serializer.uint32(obj.task_seq, buffer, bufferOffset);
    // Serialize message field [task_name]
    bufferOffset = _serializer.string(obj.task_name, buffer, bufferOffset);
    // Serialize message field [task_parameters]
    bufferOffset = _arraySerializer.string(obj.task_parameters, buffer, bufferOffset, null);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type PandaTask
    let len;
    let data = new PandaTask(null);
    // Deserialize message field [task_seq]
    data.task_seq = _deserializer.uint32(buffer, bufferOffset);
    // Deserialize message field [task_name]
    data.task_name = _deserializer.string(buffer, bufferOffset);
    // Deserialize message field [task_parameters]
    data.task_parameters = _arrayDeserializer.string(buffer, bufferOffset, null)
    return data;
  }

  static getMessageSize(object) {
    let length = 0;
    length += _getByteLength(object.task_name);
    object.task_parameters.forEach((val) => {
      length += 4 + _getByteLength(val);
    });
    return length + 12;
  }

  static datatype() {
    // Returns string type for a message object
    return 'franka_msgs_archemist/PandaTask';
  }

  static md5sum() {
    //Returns md5sum for a message object
    return 'c88e821308b538b49a4a27e31e229264';
  }

  static messageDefinition() {
    // Returns full string definition for message
    return `
    uint32 task_seq
    string task_name
    string[] task_parameters
    
    `;
  }

  static Resolve(msg) {
    // deep-construct a valid message object instance of whatever was passed in
    if (typeof msg !== 'object' || msg === null) {
      msg = {};
    }
    const resolved = new PandaTask(null);
    if (msg.task_seq !== undefined) {
      resolved.task_seq = msg.task_seq;
    }
    else {
      resolved.task_seq = 0
    }

    if (msg.task_name !== undefined) {
      resolved.task_name = msg.task_name;
    }
    else {
      resolved.task_name = ''
    }

    if (msg.task_parameters !== undefined) {
      resolved.task_parameters = msg.task_parameters;
    }
    else {
      resolved.task_parameters = []
    }

    return resolved;
    }
};

module.exports = PandaTask;
