const getList = (item) => {
  const { serviceList } = item;
  return serviceList || [];
};

const getModelClass = (item) => {
  const { componentExtInfo } = item;
  const { styleMode = 'a' } = componentExtInfo || {};
  return `model-${styleMode}`;
};

const getImage = (url, prefix) => {
  url = url || '';
  return url.length === 32 ? prefix + url : url;
};

/*
* 获取item样式
* */
const getItemStyle = (item, imgSrcPrefix ) => {
  const styles = [];
  const { backgroundImage } = item.extInfo || {};
  if (backgroundImage) {
    styles.push(`background-image:url(${getImage(backgroundImage, imgSrcPrefix)})`);
  }
  return styles.join(';');
};

export default {
  getList,
  getImage,
  getItemStyle,
  getModelClass,
};
