export default [
  // 用户列表
  {
    url: '/api/users',
    method: 'get',
    response: () => {
      return {
        code: 200,
        message: 'success',
        data: Array.from({ length: 10 }, (_, index) => ({
          id: index + 1,
          name: `@cname`,
          age: Math.floor(Math.random() * 42) + 18,
          gender: Math.random() > 0.5 ? '男' : '女',
          email: `@email`,
          phone: /^1[3-9]\d{9}$/,
          address: `@county(true)`,
          createTime: `@datetime`
        }))
      }
    }
  },

  // 用户详情
  {
    url: '/api/users/:id',
    method: 'get',
    response: ({ query }) => {
      return {
        code: 200,
        message: 'success',
        data: {
          id: query.id,
          name: `@cname`,
          age: Math.floor(Math.random() * 42) + 18,
          gender: Math.random() > 0.5 ? '男' : '女',
          email: `@email`,
          phone: /^1[3-9]\d{9}$/,
          address: `@county(true)`,
          createTime: `@datetime`
        }
      }
    }
  },

  // 创建用户
  {
    url: '/api/users',
    method: 'post',
    response: () => {
      return {
        code: 200,
        message: 'success',
        data: {
          id: `@id`,
          createTime: `@datetime`
        }
      }
    }
  },

  // 更新用户
  {
    url: '/api/users/:id',
    method: 'put',
    response: () => {
      return {
        code: 200,
        message: 'success'
      }
    }
  },

  // 删除用户
  {
    url: '/api/users/:id',
    method: 'delete',
    response: () => {
      return {
        code: 200,
        message: 'success'
      }
    }
  }
]
