// 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 TaskStatus {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.task_state = null;
      this.task_seq = null;
      this.task_name = null;
    }
    else {
      if (initObj.hasOwnProperty('task_state')) {
        this.task_state = initObj.task_state
      }
      else {
        this.task_state = 0;
      }
      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 = '';
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type TaskStatus
    // Serialize message field [task_state]
    bufferOffset = _serializer.int32(obj.task_state, buffer, bufferOffset);
    // 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);
    return bufferOffset;
  }

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

  static getMessageSize(object) {
    let length = 0;
    length += _getByteLength(object.task_name);
    return length + 12;
  }

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

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

  static messageDefinition() {
    // Returns full string definition for message
    return `
    int32 EXECUTING = 0
    int32 WAITING = 1
    int32 FINISHED = 2
    int32 ERROR = 3
    int32 task_state
    uint32 task_seq
    string task_name
    `;
  }

  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 TaskStatus(null);
    if (msg.task_state !== undefined) {
      resolved.task_state = msg.task_state;
    }
    else {
      resolved.task_state = 0
    }

    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 = ''
    }

    return resolved;
    }
};

// Constants for message
TaskStatus.Constants = {
  EXECUTING: 0,
  WAITING: 1,
  FINISHED: 2,
  ERROR: 3,
}

module.exports = TaskStatus;
