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

export function createLifestyleTemplate(): TemplateContent {
  return {
    avatar:
      'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/V7kbZ_qYgCD_OgpJuhlz6.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.example.com',
        type: SocialProfileLinkTypes.WEBSITE
      },
      {
        link: 'https://www.tiktok.com/@tiktok',
        type: SocialProfileLinkTypes.TIKTOK
      },
      {
        link: 'example@example.com',
        type: SocialProfileLinkTypes.EMAIL
      },
      {
        link: 'https://www.youtube.com/user/youtube',
        type: SocialProfileLinkTypes.YOUTUBE
      }
    ],
    modules: [
      createFeaturedVideoModule({ order: 0 }),
      createJoinMyProgramModule({ order: 2 }),
      createBrandPartnersModule({ order: 1 }),
      createFavoriteProductsModule({ order: 2 }),
      createTrainingPlaylistModule({ order: 3 }),
      createWorkTogetherDataCaptureModule({ order: 4 }),
      createExclusiveUpdatesDataCaptureModule({ order: 5 })
    ]
  }
}

function createFeaturedVideoModule({ order }: { order: number }) {
  return createModule({
    type: ModuleType.YOUTUBE_VIDEO,
    name: 'Featured Video',
    order,
    data: {
      items: [
        {
          metadata: {
            title: 'My Biggest Training Mistakes',
            author_name: 'Mike Thurston',
            author_url: 'https://www.youtube.com/@MikeThurston',
            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/lHeMwbsDwic/hqdefault.jpg',
            html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/lHeMwbsDwic?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="My Biggest Training Mistakes"></iframe>'
          },
          url: 'https://www.youtube.com/watch?v=lHeMwbsDwic',
          order: 0,
          visible: true
        }
      ]
    }
  })
}

const createJoinMyProgramModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.LINK,
    name: 'Join My Program',
    order,
    data: {
      items: [
        {
          url: 'https://www.chelseyrosetraining.com/personalized-program',
          order: 0,
          title: 'Get Started',
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/mBCY2ILitgcfKn9psxkG0.webp'
        }
      ]
    }
  })
}

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'
        }
      ]
    }
  })
}

const createFavoriteProductsModule = ({ order }: OrderedParams) =>
  createModule({
    name: 'Favorite Products',
    type: ModuleType.LINK,
    order,
    data: {
      items: [
        {
          title: 'WHOOP',
          url: 'https://join.whoop.com/en-eu/mikethurston',
          order: 0,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/ncF8x778tSHQhy-c_6xy1.jpeg'
        },
        {
          title: 'AG1',
          url: 'https://drinkAG1.com/richroll',
          order: 1,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/tFzKRHarTR8ZgxAdLVoIv.jpeg'
        },
        {
          title: 'Roka',
          url: 'https://www.roka.com/richroll',
          order: 2,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/paF0eqrnn59gn5opk9A-o.jpeg'
        }
      ]
    }
  })

const createTrainingPlaylistModule = ({ order }: OrderedParams) =>
  createModule({
    name: 'Training Playlist',
    type: ModuleType.MUSIC,
    order,
    data: {
      items: [
        {
          id: '97a75b3d-c336-4a04-89c2-6a0fe63cf9ef',
          type: 'NORMAL',
          links: [
            {
              url: 'https://open.spotify.com/track/5ayvx8hZKuQxlxbTH3D327',
              type: 'SPOTIFY',
              order: 0
            },
            {
              url: 'https://music.apple.com/us/album/reckless-with-your-love/1439624490?i=1439624492',
              type: 'APPLE_MUSIC',
              order: 1
            }
          ],
          order: 0,
          artists: [],
          urlSlug: 'reckless-with-your-love',
          visible: true,
          metadata: {
            name: 'Reckless (With Your Love)',
            type: 'TRACK',
            images: [
              {
                url: 'https://i.scdn.co/image/ab67616d0000b273bb7712a3d3d9dfe7517d5e1f',
                width: 640,
                height: 640
              }
            ],
            length: 347,
            artists: [
              {
                name: 'Azari & III'
              }
            ],
            albumName: 'Azari & III',
            previewUrl:
              'https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview128/v4/19/9b/4a/199b4aa3-484d-3f47-18b8-c25d74cc33c7/mzaf_1513240816008225300.plus.aac.p.m4a',
            externalIds: {
              upc: '00602527953069',
              isrc: 'GBX8P1100014'
            },
            releaseYear: 2011,
            resourceIds: {
              ALBUM: '7vd55snhAOrAXNsqxBqX1T',
              TRACK: '5ayvx8hZKuQxlxbTH3D327'
            }
          }
        },
        {
          id: '3c846d60-7163-4a4a-89a9-7e5f9e3e18c7',
          type: 'NORMAL',
          links: [
            {
              url: 'https://open.spotify.com/track/5kAwEqCAJ4yHdHmlAMSczs',
              type: 'SPOTIFY',
              order: 0
            },
            {
              url: 'https://music.apple.com/us/album/these-are-just-places-to-me-now/1469880784?i=1469881138',
              type: 'APPLE_MUSIC',
              order: 1
            }
          ],
          order: 1,
          artists: [],
          urlSlug: 'these-are-just-places-to-me-now',
          visible: true,
          metadata: {
            name: 'These Are Just Places To Me Now',
            type: 'TRACK',
            images: [
              {
                url: 'https://i.scdn.co/image/ab67616d0000b273891391ef7b7a14c7d938a788',
                width: 640,
                height: 640
              }
            ],
            length: 422,
            artists: [
              {
                name: 'Folamour'
              }
            ],
            albumName: 'Ordinary Drugs',
            previewUrl:
              'https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview112/v4/6b/16/ad/6b16ad46-1f3a-a4f0-d68b-2ca3fdd57fb6/mzaf_3170454564746974441.plus.aac.p.m4a',
            externalIds: {
              upc: '3615939562405',
              isrc: 'GBKQU1905220'
            },
            releaseYear: 2019,
            resourceIds: {
              ALBUM: '3na24PKpM5Bh0xwvIcpPms',
              TRACK: '5kAwEqCAJ4yHdHmlAMSczs'
            }
          }
        },
        {
          type: 'NORMAL',
          links: [
            {
              url: 'https://open.spotify.com/track/5PlBnkB04KU0YtFSEls01E',
              type: 'SPOTIFY',
              order: 0
            },
            {
              url: 'https://music.apple.com/us/album/play-with-my/1436029151?i=1436029152',
              type: 'APPLE_MUSIC',
              order: 1
            }
          ],
          order: 2,
          artists: [],
          urlSlug: 'play-with-my',
          visible: true,
          metadata: {
            name: 'Play With My...',
            type: 'TRACK',
            images: [
              {
                url: 'https://i.scdn.co/image/ab67616d0000b2733bd282cb191cf4021b1ef24a',
                width: 640,
                height: 640
              }
            ],
            length: 447,
            artists: [
              {
                name: 'N.W.N.'
              }
            ],
            albumName: 'Play With My...',
            previewUrl:
              'https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview115/v4/ec/3e/00/ec3e008b-da86-6c16-8b5b-a170a2c072d3/mzaf_16941437273554829699.plus.aac.p.m4a',
            externalIds: {
              upc: '5054283871715',
              isrc: 'GBKQU1888209'
            },
            releaseYear: 2018,
            resourceIds: {
              ALBUM: '76nSFuthlvEnfJj3Dw83X9',
              TRACK: '5PlBnkB04KU0YtFSEls01E'
            }
          }
        },
        {
          type: 'NORMAL',
          links: [
            {
              url: 'https://open.spotify.com/track/4q7XpZJvOrt0huFtzCM41l',
              type: 'SPOTIFY',
              order: 0
            },
            {
              url: 'https://music.apple.com/us/album/i-can-feel-fingertips-yahlic-remix/1462323789?i=1462323994',
              type: 'APPLE_MUSIC',
              order: 1
            }
          ],
          order: 3,
          artists: [],
          urlSlug: 'i-can-feel-fingertips--yahlic-remix',
          visible: true,
          metadata: {
            name: 'I Can Feel (Fingertips) - Yahlic Remix',
            type: 'TRACK',
            images: [
              {
                url: 'https://i.scdn.co/image/ab67616d0000b273505a9cf68ded84617024fcdb',
                width: 640,
                height: 640
              }
            ],
            length: 298,
            artists: [
              {
                name: 'Ferdinand Weber'
              },
              {
                name: 'Yahlic'
              }
            ],
            albumName: 'I Can Feel (Fingertips) [Remixes]',
            previewUrl:
              'https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview124/v4/9c/ed/7e/9ced7e73-acef-dc82-5c22-50de5bdabe66/mzaf_11015565411271544447.plus.aac.p.m4a',
            externalIds: {
              upc: '5054526191815',
              isrc: 'GBKPL1949809'
            },
            releaseYear: 2019,
            resourceIds: {
              ALBUM: '1wI0RWM0O6GmFYnU1OYITw',
              TRACK: '4q7XpZJvOrt0huFtzCM41l'
            }
          }
        }
      ]
    }
  })

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
        }
      ]
    }
  })

const createExclusiveUpdatesDataCaptureModule = ({ order }: OrderedParams) =>
  createModule({
    name: 'Exclusive updates',
    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
        }
      ]
    }
  })
