import { DelPhotoParam } from '../models'

export class YTRouter extends NavPathStack {
  private static declare instance: YTRouter

  private constructor() {
    super()
  }

  static getInstance() {
    if (!YTRouter.instance) {
      YTRouter.instance = new YTRouter()
    }
    return YTRouter.instance
  }

router2DecisionPage(name:string){
    YTRouter.getInstance().pushPathByName(name,'')
  }

  router2SettingPage() {
    yTRouter.pushPathByName('SettingPage', '')
  }

  router2SuggestionPage() {
    yTRouter.pushPathByName('SuggestionPage', '')
  }

  router2AgreementPage(param: '关于我们' | '隐私政策' | '用户协议') {
    yTRouter.pushPathByName('AgreementPage', param)
  }

  /**
   * 跳转至用户协议
   */
  router2userAgreement() {
    yTRouter.pushPathByName('UserAgreementPage', '')
  }

  /**
   * 跳转至隐私政策
   */
  router2Privacy() {
    yTRouter.pushPathByName('Privacy', '')
  }

  router2AboutUS() {
    yTRouter.pushPathByName('AboutUS', '')
  }

  getAgreementPageParam() {
    return yTRouter.getParamByName('AgreementPage').pop() as '关于我们' | '隐私政策' | '用户协议'
  }

  router2LoginPage() {
    yTRouter.pushPathByName('LoginPage', '')
  }

  router2DelPhotoPage(param: DelPhotoParam) {
    yTRouter.pushPathByName('DelPhotoPage', param)
  }

  getDelPhotoParam() {
    return yTRouter.getParamByName('DelPhotoPage').pop() as DelPhotoParam
  }

  routerBack() {
    yTRouter.pop()
  }
}

export const yTRouter = YTRouter.getInstance()
