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

export function createOtherTemplate(): TemplateContent {
  return {
    avatar:
      'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/tB82XzHIYudH6jeP3KJzH.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: 'example@example.com',
        type: SocialProfileLinkTypes.EMAIL
      },
      {
        link: 'https://www.example.com',
        type: SocialProfileLinkTypes.WEBSITE
      },
      {
        link: 'https://www.facebook.com/facebook',
        type: SocialProfileLinkTypes.FACEBOOK
      },
      {
        link: 'https://www.youtube.com/user/youtube',
        type: SocialProfileLinkTypes.YOUTUBE
      }
    ],
    modules: [
      createProductModule({ order: 0 }),
      createEventsModule({ order: 1 }),
      createStayInformedModule({ order: 2 }),
      createVideosModule({ order: 3 }),
      createSharePressModule({ order: 4 })
    ]
  }
}

const createProductModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.PRODUCT,
    name: 'Products',
    order,
    data: {
      items: [
        {
          url: 'https://shop.dearmedia.com/collections/note-to-self/products/note-to-self-lucky-tee',
          order: 0,
          price: 35,
          title: 'NOTE TO SELF: LUCKY TEE',
          visible: true,
          currency: 'USD',
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/zJao1pNDd_h8NH-vLG2Pe.jpg'
        },
        {
          url: 'https://shop.dearmedia.com/collections/note-to-self/products/note-to-self-222-tee',
          order: 1,
          price: 35,
          title: 'NOTE TO SELF: 222 TEE',
          visible: true,
          currency: 'USD',
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/BsUr1sA6ygP0yhXasL139.jpg'
        },
        {
          url: 'https://shop.dearmedia.com/collections/note-to-self/products/note-to-self-members-crew-burgundy',
          order: 2,
          price: 48,
          title: 'NOTE TO SELF: MEMBER’S CREW BURGUNDY',
          visible: true,
          currency: 'USD',
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/Fx8QGIWTwisdgpuB21-sA.jpg'
        }
      ]
    }
  })
}

const createEventsModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.EVENTS,
    name: 'Events',
    order,
    data: {
      items: [
        {
          eventDate: '2024-05-09T23:59:59.999Z',
          venueName: 'Hollywood Bowl',
          location: 'Los Angeles, CA',
          ticketLink: 'https://www.bandsintown.com/e/104986854',
          soldOut: false,
          visible: true
        },
        {
          eventDate: '2024-03-22T23:59:59.999Z',
          venueName: 'Mahaffey Theater',
          location: 'Saint Petersburg, FL',
          ticketLink: 'https://www.bandsintown.com/e/104286058',
          soldOut: false,
          visible: true
        }
      ]
    }
  })
}

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

const createVideosModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.YOUTUBE_VIDEO,
    name: 'Videos',
    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
        },
        {
          url: 'https://www.youtube.com/watch?v=nFdNvI76-Sg&pp=ygUcIE1hcmphbiBUYWJpYnphZGFpbnRlcnZpZXdzIA%3D%3D',
          order: 1,
          visible: true,
          metadata: {
            html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/nFdNvI76-Sg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Influencers ‘very resilient’ in considering migration from TikTok amid possible ban: Content creator"></iframe>',
            type: 'video',
            title:
              'Influencers ‘very resilient’ in considering migration from TikTok amid possible ban: Content creator',
            width: 200,
            height: 113,
            version: '1.0',
            author_url: 'https://www.youtube.com/@YahooFinance',
            author_name: 'Yahoo Finance',
            provider_url: 'https://www.youtube.com/',
            provider_name: 'YouTube',
            thumbnail_url: 'https://i.ytimg.com/vi/nFdNvI76-Sg/hqdefault.jpg',
            thumbnail_width: 480,
            thumbnail_height: 360
          }
        }
      ]
    }
  })
}

const createSharePressModule = ({ order }: OrderedParams) => {
  return createModule({
    type: ModuleType.LINK,
    name: 'Share Press',
    order,
    data: {
      items: [
        {
          title:
            'Rolling Stone | Munya Chawawa on redefining masculinity through his comedy',
          url: 'https://www.rollingstone.co.uk/tv/features/munya-chawawa-interview-comedy-rolling-stone-33917/',
          order: 0,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/EZ11NYEI_fHGqX81y4ogp.jpeg'
        },
        {
          title:
            'The Guardian | Family joke-offs, double life, and going viral',
          url: 'https://www.theguardian.com/lifeandstyle/2023/oct/14/munya-chawawa-looks-back-bullies-shamed-me-for-being-proud-of-my-culture-so-id-go-home-and-write-raps-about-the-cold-hard-streets-of-norfolk',
          order: 1,
          visible: true,
          thumbnail:
            'https://komi-production-assets.s3-accelerate.amazonaws.com/photos/GpXr-LjUoaxYA9sCAFXv_.jpeg'
        }
      ]
    }
  })
}
