import { buildProps } from '@kankan-components/utils'
import type { ExtractPropTypes, PropType } from 'vue'

export type DaikanUserInfoType = {
  userId: string
  roomId: string
  nickName: string
  avatar: string
  role: 'leader' | 'customer'
}
// {userId: string, roomId: string, nickName: string, avatar: string, role: 'leader' | 'customer'}
export const daikanProps = buildProps({
  socketLib: {
    type: String,
    required: false,
    default:
      'https://cdn.bootcdn.net/ajax/libs/socket.io/4.5.4/socket.io.min.js',
  },
  socketUrl: {
    type: String,
    required: true,
  },
  userInfo: {
    type: Object as PropType<DaikanUserInfoType>,
    required: true,
  },
} as const)
export type DaikanProps = ExtractPropTypes<typeof daikanProps>
