import { OrderedParams, TemplateContent } from './types'
import { createModule } from './createModule'
import { SocialProfileLinkTypes } from '../../redux/User/types'
import { ModuleType } from '@komi-app/shared-types'

export function createInfluencerTemplate(): TemplateContent {
  return {
    avatar:
      'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/gW6BFq8Hd8sPHWKo9JC6B.png?tr=w-564%2Ch-709%2Ccm-extract%2Cx-0%2Cy-0&crp=%7B%22x%22%3A0%2C%22y%22%3A0%2C%22zoomVal%22%3A1%7D',
    socialProfileLinks: [
      {
        link: 'https://www.instagram.com/instagram',
        type: SocialProfileLinkTypes.INSTAGRAM
      },
      {
        link: 'https://www.tiktok.com/@tiktok',
        type: SocialProfileLinkTypes.TIKTOK
      },
      {
        link: 'https://www.youtube.com/user/youtube',
        type: SocialProfileLinkTypes.YOUTUBE
      },
      {
        link: 'example@example.com',
        type: SocialProfileLinkTypes.EMAIL
      },
      {
        link: 'https://www.example.com',
        type: SocialProfileLinkTypes.WEBSITE
      }
    ],
    modules: [
      createFeaturedVideoModule({ order: 0 }),
      createBrandPartnersModule({ order: 1 }),
      createShopModule({ order: 2 }),
      createStayUpdatedDataCaptureModule({ order: 3 }),
      createWorkTogetherDataCaptureModule({ order: 4 })
    ]
  }
}

function createFeaturedVideoModule({ order }: { order: number }) {
  return createModule({
    type: ModuleType.YOUTUBE_VIDEO,
    name: 'Featured Video',
    order,
    data: {
      items: [
        {
          metadata: {
            title:
              'my FIRST TIME (hosting obvi ;)) ☆ learning to bake + friends + football !!',
            author_name: 'anna x sitar',
            author_url: 'https://www.youtube.com/@annaxsitar',
            type: 'video',
            height: 113,
            width: 200,
            version: '1.0',
            provider_name: 'YouTube',
            provider_url: 'https://www.youtube.com/',
            thumbnail_height: 360,
            thumbnail_width: 480,
            thumbnail_url: 'https://i.ytimg.com/vi/FDMmm2YrdfA/hqdefault.jpg',
            html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/FDMmm2YrdfA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="my FIRST TIME (hosting obvi ;)) ☆ learning to bake + friends + football !!"></iframe>'
          },
          url: 'https://www.youtube.com/watch?v=FDMmm2YrdfA',
          order: 0,
          visible: true
        }
      ]
    }
  })
}

const createBrandPartnersModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.LINK,
    name: 'Partners',
    order,
    data: {
      items: [
        {
          title: 'Rich Roll x On',
          url: 'https://www.on-running.com/en-us/stories/rich-roll',
          order: 0,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/DJZ3cwf5Xg-fArdgq3fHT.jpg'
        },
        {
          title: 'Bulk',
          url: 'https://www.bulk.com/uk/todays-offers.html?utm_source=http%3A%2F%2Fwww.londonfitnessguy.com&utm_medium=Affiliate_Marketing&utm_campaign=876413&awc=4822_1649848992_7f6dcd0b170d4e2887b8ccc9247d4231',
          order: 1,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/n-soLRTuiiVSH8plY8Tec.webp'
        },
        {
          title: 'Technogym',
          url: 'https://www.technogym.com/en-INT/',
          order: 2,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/xAlnp83N_ht4w3Kd0kxyg.webp'
        },
        {
          title: 'Vegamour',
          url: 'https://vegamour.com/',
          order: 3,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/kCOYZxwLwTb3vwPM0icwZ.jpg'
        }
      ]
    }
  })
}

const createShopModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.LINK,
    name: 'Shop My Favourites',
    order,
    data: {
      items: [
        {
          url: 'https://www.shopltk.com/explore/paytonsartain',
          order: 0,
          title: 'Shop LTK',
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/64YEZ4HvX5WKspPO0ocM3.png'
        },
        {
          url: 'https://www.amazon.com/shop/paytonsartain',
          order: 0,
          title: 'Amazon',
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/LmyZ0rzkaaFAplIfpcMz4.jpg'
        }
      ]
    }
  })
}

const createStayUpdatedDataCaptureModule = ({ order }: OrderedParams) =>
  createModule({
    name: 'Stay Updated!',
    type: ModuleType.FORM_DATA,
    order,
    data: {
      items: [
        {
          form: {
            name: 'Updates',
            fields: [
              {
                name: 'EMAIL_ADDRESS',
                type: 'EMAIL_ADDRESS',
                label: 'Enter email',
                order: 1,
                required: true
              },
              {
                name: 'INPUT',
                type: 'INPUT',
                label: 'Name',
                order: 0,
                required: true
              }
            ]
          },
          order: 0,
          title: 'Exclusive updates',
          layout: 'left',
          visible: true,
          subTitle: 'Receive updates and exclusive discounts',
          enableImage: false
        }
      ]
    }
  })

const createWorkTogetherDataCaptureModule = ({ order }: OrderedParams) =>
  createModule({
    name: 'Work Together!',
    type: ModuleType.FORM_DATA,
    order,
    data: {
      items: [
        {
          form: {
            name: 'Updates',
            fields: [
              {
                name: 'EMAIL_ADDRESS',
                type: 'EMAIL_ADDRESS',
                label: 'Enter email',
                order: 1,
                required: true
              },
              {
                name: 'INPUT',
                type: 'INPUT',
                label: 'Name',
                order: 0,
                required: true
              }
            ]
          },
          order: 0,
          title: 'Business enquiries',
          layout: 'left',
          visible: true,
          subTitle: "Let's explore working together",
          enableImage: false
        }
      ]
    }
  })
