import type { MockMethod } from './types'

const mock: MockMethod[] = [
  {
    url: '/mock-api/admin/login',
    method: 'post',
    response: (req: any) => {
      const { username, password, rememberMe } = req.body
      if (username === 'admin' && password === 'admin123') {
        return {
          code: 0,
          message: 'success',
          data: {
            token: rememberMe ? 'eyJhbGciOiJIUzI1NiJ9.admin.7d' : 'eyJhbGciOiJIUzI1NiJ9.admin.8h',
            expiresIn: rememberMe ? 604800 : 28800,
          },
        }
      }
      return { code: 40001, message: '用户名或密码错误', data: null }
    },
  },
]

export default mock
