import { reactive, ref } from '../../adapter-vue';
import { TUIStore, StoreName, NAME, CallStatus, CallRole, CallMediaType } from '../../TUICallService';

const callStatus = ref(TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS));
const callRole = ref(TUIStore.getData(StoreName.CALL, NAME.CALL_ROLE));
const callType = ref(TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE));
const isGroupCall = ref(TUIStore.getData(StoreName.CALL, NAME.IS_GROUP));
const isEarPhone = ref(TUIStore.getData(StoreName.CALL, NAME.IS_EAR_PHONE));
const focusElement = ref(null);

export type TCallInfoContextValue = {
  callStatus?: CallStatus,
  callRole?: CallRole,
  callType?: CallMediaType,
  isGroupCall?: boolean,
  isEarPhone?: boolean,
  focusElement?: string | null,
};
export const callInfoContextValue = reactive({
  callStatus,
  callRole,
  callType,
  isGroupCall,
  isEarPhone,
  focusElement,
});
export const CallInfoContextKey = 'CallInfoContextKey';
