import Mock from 'mockjs'
import { MockMethod } from 'vite-plugin-mock'

const mockMethodEight: MockMethod[] = [
  {
    url: '/mock/api/eight',
    method: 'get',
    timeout: 1000,
    response: () => {
      return {
        code: '0',
        data: {
          ...Mock.mock({
            customsCode: '@integer(1000, 7060)',
            startDate: '@date("yyyy-MM-dd")',
            endDate: function () {
              let endDate = Mock.Random.date()
              while (endDate < this.startDate) {
                endDate = Mock.Random.date()
              }
              return endDate
            },
            person: '@cname',
            flag: '@pick(1,0)'
          })
        }
      }
    }
  }
]

export default mockMethodEight
