interface AuthedRequest {
  token?: string
  user_id?: number
}

interface BaseResponse<T> {
  ret: number
  msg: string
  data: T
}

// TODO: PagedData schema
interface PagedData<T> {
  total: number
  page: number
  perpage: number
  items: T[]
}

interface UserSchema {
  id: number
  username: string
  nickname: string
  avatar: string
  sex: 0 | 1 | 2 // 0: 未知, 1: 男, 2: 女
  email: string
  mobile: string
  auth_code: 0 | 1 | 2 // 0: Banned, 1: User, 2: Operator
}

// Common request and response schemas
namespace req {
  namespace user {
    /**
     * @description 用户登录
     * @param username 用户名或手机号
     * @param password 密码
     */
    interface Login {
      username: string
      password: string
    }

    interface SmsLogin {
      mobile: string
    }

    interface SmsLoginVerify {
      mobile: string
      sms_code: string
    }
  }

  namespace file {
    interface Upload {
      file_name: string
      file_type: string
      file_size: number
    }
  }

  interface AssistantTemplateList {
    page: number
    perpage: number
  }
}

namespace resp {
  namespace user {
    interface CheckSession {
      is_login: boolean
    }

    interface Login {
      is_login: boolean
      token?: string
      user_id?: number
    }

    interface Profile {
      profile: UserSchema
    }

    interface SmsLogin {
      message: string
    }

    interface SmsLoginVerify {
      token: string
      person_id: number
    }
  }
}

// Specific modals
namespace HunYuan {
  type Resolution = '768:768' | '768:1024' | '1024:768'

  interface resp {
    data_id: string | number
    request_id: string
    request_image: string
  }

  namespace Text2Img {
    interface req {
      device_id: string
      prompt: string
      negative_prompt?: string
      styles: number
      resolution: string
    }
  }

  namespace Img2Img {
    interface req {
      device_id: string
      prompt: string
      negative_prompt?: string
      styles: number
      resolution: string
      file: File
    }
  }
}
