/*
 * @param parseObject [ParseObject]
 * @return [Object]
 * */
export const convertBrand = (parseObject) => {
  const ret = {};
  const object = parseObject.toJSON();

  ret.id = object.objectId;
  ret.name = object.name;
  ret.description = object.description;
  ret.images = (object.images || []).map(image => ({ id: image.objectId, url: image.file.url }));

  return ret;
};

/*
* @param parseObject [ParseObject]
* @return [Object]
* */
export const convertProduct = (parseObject) => {
  const ret = {};
  const object = parseObject.toJSON();

  ret.id = object.objectId;
  ret.brand_id = object.brand.objectId;
  ret.name = object.name;
  ret.description = object.description;
  ret.images = object.images.map(image => ({ id: image.objectId, url: image.file.url }));
  ret.size = object.size;
  ret.color = object.color;
  ret.cost = object.cost;
  ret.price = object.price;
  ret.quantity = object.quantity;

  return ret;
};
