declare namespace API {
  type UserListDept = {
    deptId: number
    deptName: string
  }

  type UserListPostListItem = {
    postId: number
    postName: string
  }

  type UserListRoleListItem = {
    roleId: number
    roleName: string
  }

  type UserListPageResultItem = {
    userId: number
    nickname?: any
    realName: string
    email: string
    username: string
    mpOpenId?: any
    createdTime: string
    modifiedTime: string
    delFlag: string
    lockFlag: string
    phone: string
    avatar?: any
    dept: UserListDept
    tenantId: number
    postList: UserListPostListItem[]
    roleList: UserListRoleListItem[]
  }

  /** 获取用户列表结果 */
  type UserListPageResult = UserListPageResultItem[]

  /** 编辑用户参数 */
  type UserParams = {
    userId: string
    username: string
    password?: string
    avatar: string
    lockFlag: 'OK' | 'LOCKED'
    phone: string
    deptId: number
    /** 昵称 */
    nickname: string
    /** 真实姓名 */
    realName: string
    email: string
    /** 职位ID */
    postIds: number[]
    roleIds: number[]
    createdTime: string
  }

  /** 新增用户参数 */
  type AddUserParams = Omit<UserParams, 'userId' | 'createdTime'>

  /** 用户信息 */
  type SysUser = {
    userId: number
    username: string
    password: string
    nickname: string
    realName: string
    phone: string
    avatar: string | null
    deptId: number
    tenantId: number
    mpOpenId?: any
    email: string
    delFlag: string
    lockFlag: string
    createdBy: string
    modifiedBy: string
    createdTime: string
    modifiedTime: string
  }
  type UserInfo = {
    sysUser: SysUser
    permissions: string[]
    roles: number[]
  }

  /** 用户详细信息 */
  type UserDetail = SysUser & {
    deptName: string
    salt?: any
    wxOpenid?: any
    postList: UserListPostListItem[]
    roleList: UserListRoleListItem[]
  }
}
