import { CSSProperties } from 'vue'
import { IVocals } from '/src/constant/fingering-colexiu'
import relationships from '/src/constant/fingering-relationships'

export type Fingering = {
  json: any
  relationship: Object
  height?: number | string
  width?: number | string
  maxWidth?: number
  styles?: CSSProperties
} | null

export default async (type: IVocals): Promise<Fingering> => {
  switch (type) {
    case 'flute':
      const flute = await import(`/src/fingering/flute/index.json`)
      return {
        json: flute.default,
        relationship: relationships.flute,
        height: '60px',
        styles: {},
      }
    case 'clarinet':
      const clarinet = await import(`/src/fingering/clarinet/index.json`)
      return {
        json: clarinet.default,
        relationship: relationships.clarinet,
        styles: {
          marginLeft: '.4rem',
          marginRight: '.7rem',
        },
      }
    case 'trumpet':
      const trumpet = await import(`/src/fingering/trumpet/index.json`)
      return {
        json: trumpet.default,
        relationship: relationships.trumpet,
        // maxWidth: 150,
      }
    case 'horn':
      const horn = await import(`/src/fingering/horn/index.json`)
      return {
        json: horn.default,
        relationship: relationships.horn,
        height: '212px',
        width: '252px',
      }
    case 'tuba':
      const tuba = await import(`/src/fingering/tuba/index.json`)
      return {
        json: tuba.default,
        relationship: relationships.tuba,
      }
    case 'piccolo':
      const piccolo = await import(`/src/fingering/piccolo/index.json`)
      return {
        json: piccolo.default,
        relationship: relationships.piccolo,
      }
    case 'up-bass-horn':
      const upBassHorn = await import(`/src/fingering/up-bass-horn/index.json`)
      return {
        json: upBassHorn.default,
        relationship: relationships.upBassHorn,
      }
    case 'trombone':
      const trombone = await import(`/src/fingering/trombone/index.json`)
      return {
        json: trombone.default,
        relationship: relationships.trombone,
      }
    case 'saxophone':
      const saxophone = await import(`/src/fingering/saxophone/index.json`)
      return {
        json: saxophone.default,
        relationship: relationships.saxophone,
        styles: {
          marginLeft: '.2rem',
          marginRight: '.3rem',
        },
      }
    case 'small-drum':
      const smallDrum = await import(`/src/fingering/small-drum/index.json`)
      return {
        json: smallDrum.default,
        relationship: relationships.smallDrum,
        width: '180px',
        // styles: {
        //   marginLeft: '.2rem',
        //   marginRight: '.3rem',
        // }
      }

    case 'hulusi-flute':
      const hulusi = await import(`/src/fingering/hulusi-flute/index.json`)
      return {
        json: hulusi.default,
        relationship: relationships.hulusi,
        // width: '180px',
        styles: {
          marginLeft: '.6rem',
          marginRight: '.7rem',
        },
      }
    case 'pan-flute':
      const pan = await import(`/src/fingering/pan-flute/index.json`)
      return {
        json: pan.default,
        relationship: relationships.pan,
        width: '240px',
        styles: {
          marginTop: 'auto',
          marginLeft: '.6rem',
          marginRight: '.7rem',
        },
      }
    case 'ocarina':
      const ocarina = await import(`/src/fingering/ocarina/index.json`)
      return {
        json: ocarina.default,
        relationship: relationships.ocarina,
        width: '180px',
        styles: {
          marginTop: 'auto',
          // marginLeft: '.6rem',
          // marginRight: '.7rem',
        },
      }
    case 'melodica':
      const melodica = await import(`/src/fingering/melodica/index.json`)
      return {
        json: melodica.default,
        relationship: relationships.melodica,
        height: '80px',
        styles: {
          marginTop: 'auto',
          // marginLeft: '.6rem',
          // marginRight: '.7rem',
        },
      }
    case 'ukulele':
      const ukulele = await import(`/src/fingering/ukulele/index.json`)
      return {
        json: ukulele.default,
        relationship: relationships.ukulele,
      }
    case 'mouthorgan':
      const mouthorgan = await import(`/src/fingering/mouthorgan/index.json`)
      return {
        json: mouthorgan.default,
        relationship: relationships.mouthorgan,
      }
    case 'piano':
      const piano = await import(`/src/fingering/piano/index.json`)
      return {
        json: piano.default,
        relationship: relationships.piano,
      }
    default:
      return null
  }
}
