export interface DIDConnectCustomQuery {
  forceConnected: string; // 填写用户的 DID
  sourceAppPid?: string; // 应用程序 PID
  switchBehavior?: 'auto' | 'disabled' | 'required'; // auto 代表引导切换，disabled 代表不提示，required 代表强制要求切换
  showClose?: boolean; // 是否显示关闭按钮
}

function getDidConnectQueryParams(params: DIDConnectCustomQuery) {
  const didConnectQueryParams: DIDConnectCustomQuery = {
    switchBehavior: 'auto',
    showClose: false,
    ...params,
  };

  return {
    '__did-connect__': Buffer.from(JSON.stringify(didConnectQueryParams), 'utf8').toString('base64'),
  };
}

export { getDidConnectQueryParams };
