import {Platform} from 'react-native';
import {loginSchema} from '../../api/loginSchema';
import { useApi } from '@common/api/useApi.ts';

// 用户注册
// {"changeDevice":false,"enableCert":false,"gxLeader":false,"hasBindFirm":false,"hasFaceDetect":false,"hasPwd":false,"realNameStatus":0,"sessionId":"c701897a-3c49-4d82-b5db-d4c37f91a3eb","userId":"f964953d16f64e6ba64567dda76c3467","userType":2}

const useRegister = (
  phone: string,
  smsCode: string,
  nickname: string,
  invitationCode: string,
  password: string,
) => {
  return useApi(
    '/am/v4/userCenter/register',
    'POSTJSON',
    {
      phoneNum: phone,
      verifyCode: smsCode,
      nickname: nickname,
      khcrmTeamCode: invitationCode,
      pwd: password,
      deviceType: Platform.select({android: '0', ios: '1'}),
    },
    loginSchema,
    {},
  );
};

export {useRegister};
