export enum JobType {
  All = 'ALL',
  Finery = 'FINERY', // 服饰
  Makeups = 'MAKEUPS', // 美妆
  Digital = 'DIGITAL', //数码
  Foods = 'FOODS', // 食品酒饮
  Jewelry = 'JEWELRY', // 珠宝
  Appliance = 'APPLIANCE', // 家电
  Furniture = 'FURNITURE', // 日用家具
  PetFamily = 'PET_FAMILY', // 母婴宠物
  Luxury = 'LUXURY', // 奢品
  LocalLive = 'LOCAL_LIVE', // 本地生活
  Car = 'CAR', // 汽车
  Play = 'PLAY', // 娱乐
  Other = 'OTHER', // 娱乐
}

export enum EmployType {
  All = 'ALL',
  Full = 'FULL_TIME',
  Part = 'PARTY_TIME',
}

export enum SortType {
  RECOMMEND = 'RECOMMEND',
  DISTANCE = 'DISTANCE',
  CREATE_TIME = 'CREATETIME',
}

export enum UserJobType {
  MyDeclared = 0,
  MyBrowsed = 1,
}

export enum JobManageType {
  All = 'ALL',
  Open = 'OPEN',
  Pending = 'PENDING',
  Error = 'FAIL',
}

export enum JobManageStatus {
  WaitVerify = 0,
  Open = 1,
  Error = 2,
  Pending = 3,
  Close = 4,
  Expire = 5,
}

export const ALL_JOB_TYPES = Object.values(JobType);

export const ALL_SORT_TYPES = Object.values(SortType);

export const ALL_EMPLOY_TYPES = Object.values(EmployType);

export const SORT_TYPE_TITLE_MAP = {
  [SortType.RECOMMEND]: '推荐',
  [SortType.DISTANCE]: '附近',
  [SortType.CREATE_TIME]: '最新',
};

export const EMPLOY_TYPE_TITLE_MAP = {
  [EmployType.All]: '全部',
  [EmployType.Part]: '兼职',
  [EmployType.Full]: '全职',
};

export const JOB_TYPE_TITLE_MAP: { [key in JobType]: string } = {
  [JobType.All]: '全部',
  [JobType.Finery]: '服饰',
  [JobType.Makeups]: '美妆',
  [JobType.Digital]: '数码',
  [JobType.Foods]: '食品酒饮',
  [JobType.Jewelry]: '珠宝',
  [JobType.Appliance]: '家电',
  [JobType.Furniture]: '日用家具',
  [JobType.PetFamily]: '母婴宠物',
  [JobType.Luxury]: '奢品',
  [JobType.LocalLive]: '本地生活',
  [JobType.Car]: '汽车',
  [JobType.Play]: '娱乐',
  [JobType.Other]: '其他',
};

export const JOB_MANAGE_TYPE_TITLE_MAP = {
  [JobManageType.All]: '全部',
  [JobManageType.Open]: '开放中',
  [JobManageType.Pending]: '待开放',
  [JobManageType.Error]: '审核失败',
};

export const JOB_MANAGE_STATUS_TITLE_MAP = {
  [JobManageStatus.WaitVerify]: '审核中',
  [JobManageStatus.Open]: '开放中',
  [JobManageStatus.Pending]: '待开放',
  [JobManageStatus.Error]: '审核失败',
  [JobManageStatus.Close]: '已关闭',
  [JobManageStatus.Expire]: '已关闭',
};

export const JOB_PAGE_TABS = [
  {
    type: EmployType.All,
    title: EMPLOY_TYPE_TITLE_MAP[EmployType.All],
  },
  {
    type: EmployType.Part,
    title: EMPLOY_TYPE_TITLE_MAP[EmployType.Part],
  },
  {
    type: EmployType.Full,
    title: EMPLOY_TYPE_TITLE_MAP[EmployType.Full],
  },
];

export const JOB_TABS = ALL_JOB_TYPES.map(type => ({
  type,
  title: JOB_TYPE_TITLE_MAP[type],
}));

export const JOB_MANAGE_TABS = [
  {
    type: JobManageType.All,
    title: JOB_MANAGE_TYPE_TITLE_MAP[JobManageType.All],
  },
  {
    type: JobManageType.Open,
    title: JOB_MANAGE_TYPE_TITLE_MAP[JobManageType.Open],
  },
  {
    type: JobManageType.Pending,
    title: JOB_MANAGE_TYPE_TITLE_MAP[JobManageType.Pending],
  },
  {
    type: JobManageType.Error,
    title: JOB_MANAGE_TYPE_TITLE_MAP[JobManageType.Error],
  },
];

export const JOB_TYPE_SELECT_OPTIONS = [
  { label: JOB_TYPE_TITLE_MAP[JobType.Finery], value: JobType.Finery },
  { label: JOB_TYPE_TITLE_MAP[JobType.Makeups], value: JobType.Makeups },
  { label: JOB_TYPE_TITLE_MAP[JobType.Digital], value: JobType.Digital },
  { label: JOB_TYPE_TITLE_MAP[JobType.Foods], value: JobType.Foods },
  { label: JOB_TYPE_TITLE_MAP[JobType.Jewelry], value: JobType.Jewelry },
  { label: JOB_TYPE_TITLE_MAP[JobType.Appliance], value: JobType.Appliance },
  { label: JOB_TYPE_TITLE_MAP[JobType.Furniture], value: JobType.Furniture },
  { label: JOB_TYPE_TITLE_MAP[JobType.PetFamily], value: JobType.PetFamily },
  { label: JOB_TYPE_TITLE_MAP[JobType.Luxury], value: JobType.Luxury },
  { label: JOB_TYPE_TITLE_MAP[JobType.LocalLive], value: JobType.LocalLive },
  { label: JOB_TYPE_TITLE_MAP[JobType.Car], value: JobType.Car },
  { label: JOB_TYPE_TITLE_MAP[JobType.Play], value: JobType.Play },
  { label: JOB_TYPE_TITLE_MAP[JobType.Other], value: JobType.Other },
];

const MAX_SALARY = 10000000;
export const PART_EMPLOY_SALARY_OPTIONS = [
  { label: '不限' },
  { label: '100-200', value: { minSalary: 100, maxSalary: 200 } },
  { label: '200-300', value: { minSalary: 200, maxSalary: 300 } },
  { label: '300-500', value: { minSalary: 300, maxSalary: 500 } },
  { label: '500 以上', value: { minSalary: 500, maxSalary: MAX_SALARY } },
];

export const FULL_EMPLOY_SALARY_OPTIONS = [
  { label: '不限' },
  { label: '5k-10k', value: { minSalary: 5000, maxSalary: 10000 } },
  { label: '10k-20k', value: { minSalary: 10000, maxSalary: 20000 } },
  { label: '20k-50k', value: { minSalary: 20000, maxSalary: 50000 } },
  { label: '50k 以上', value: { minSalary: 50000, maxSalary: MAX_SALARY } },
];

export const PART_PRICE_OPTIONS = PART_EMPLOY_SALARY_OPTIONS.filter(o => !!o.value);

export const FULL_PRICE_OPTIONS = FULL_EMPLOY_SALARY_OPTIONS.filter(o => !!o.value);
