import { EComponentType } from "@/consts/enum";
export function createComponentData(type: EComponentType): Record<string, any> | null {
  if(type === EComponentType.title){
    return {
      text: '',
      placeholder: '默认标题',
      layout: 'left'
    }
  }
  if(type === EComponentType.text){
    return {
      text: '',
      placeholder: '点击编辑输入您的文本内容',
      layout: 'left'
    }
  }
  if(type === EComponentType.link){
    return {
      link: '',
      layout: 'left',
      poster: '',
      linkType: '',
      text: '',
      placeholder: '默认链接',
    }
  }
  
  if(type === EComponentType.wechatArticle){
    return {
      link: '',
      layout: 'left',
      poster: '',
      linkType: 'weixinOfficialAccountArticle',
      text: '',
      placeholder: '公众号文章',
    }
  }
  if(type === EComponentType.tel){
    return {
      text: '',
      layout: 'left',
      placeholder: '默认电话',
    }
  }
  if(type === EComponentType.address){
    return  {
      address: '',
      latitude: 39.916527,
      longitude:116.397128,
      placeholder: '默认地址'
    }
  }
  // 图片/视频
  if(type === EComponentType.media){
    return  {
      media: [],
      layout: 'mini',
    }
  }
  // 小蓝本
  if(type === EComponentType.bluebook){
    return  {
      values: [],
      layout: 'mini',
    }
  }
  // 微信公众号(文章)
  // wx.openOfficialAccountProfile 
  if(type === EComponentType.wechat){
    return  {
      value: '',
      text: '',
      placeholder: '微信公众号',
      layout: 'left',
    }
  }

  // 视频号，与 普通媒体链接共用同个组件
  // editor-link-social
  if(type === EComponentType.shiping){
    return  {
      layout: 'left',
      value: '',
      text: '',
      placeholder: '视频号',
    }
  }
  // 小程序
  // editor-mii-program
  if(type === EComponentType.miniProgram){
    return  {
      value: {
        name: '',
        shortLink: '',
        poster: '',
        placeholder: '默认小程序',
      },
      layout: 'full',
    }
  }
  // 视频号视频
  // editor-channels
  if(type === EComponentType.shipingVideo){
    return  {
      value: {
        accountId: '',
        videoId: '',
        desc: '',
        poster: '',
      },
    }
  }



  return null
}