import { createShapePropsMigrationIds, createShapePropsMigrationSequence, createBindingPropsMigrationIds, createBindingPropsMigrationSequence } from '@tldraw/tldraw'
import { getDefaultCCBaseProps, getDefaultCCCalendarProps, getDefaultCCLiveTranscriptionProps, getDefaultCCSettingsProps, getDefaultCCSlideProps, getDefaultCCSlideShowProps, getDefaultCCSlideLayoutBindingProps, getDefaultCCYoutubeEmbedProps, getDefaultCCSearchProps, getDefaultCCWebBrowserProps } from './cc-props'

// Export both shape and binding migrations
export const ccBindingMigrations = {
  'cc-slide-layout': createBindingPropsMigrationSequence({
    sequence: [
      {
        id: createBindingPropsMigrationIds('cc-slide-layout', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCSlideLayoutBindingProps(),
            ...props,
          }
        },
      },
    ],
  }),
}

export const ccShapeMigrations = {
  base: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-base', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCBaseProps(),
            ...props,
          }
        },
      },
    ],
  }),

  calendar: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-calendar', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCCalendarProps(),
            ...props,
          }
        },
      },
    ],
  }),

  liveTranscription: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-live-transcription', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCLiveTranscriptionProps(),
            ...props,
          }
        },
      },
    ],
  }),

  settings: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-settings', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCSettingsProps(),
            ...props,
          }
        },
      },
    ],
  }),

  slideshow: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-slideshow', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCSlideShowProps(),
            ...props,
          }
        },
      },
    ],
  }),

  slide: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-slide', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCSlideProps(),
            ...props,
          }
        },
      },
    ],
  }),

  'cc-youtube-embed': createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-youtube-embed', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCYoutubeEmbedProps(),
            ...props,
          }
        },
      },
    ],
  }),

  search: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-search', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCSearchProps(),
            ...props,
          }
        },
      },
    ],
  }),

  webBrowser: createShapePropsMigrationSequence({
    sequence: [
      {
        id: createShapePropsMigrationIds('cc-web-browser', { Initial: 1 }).Initial,
        up: (props: Record<string, unknown>) => {
          return {
            ...getDefaultCCWebBrowserProps(),
            ...props,
          }
        },
      },
    ],
  }),
} 