import { EmployType } from '@/constants/job';
import { AnchorReadType, AnchorSortType, GenderType, ProfileCreateSource, WorkedYears } from '@/constants/material';
import { IPaginationRequest, IPaginationResponse } from '@/types/common';

export interface MaterialVideoInfo {
  url: string;
  coverUrl: string;
  type: 'image' | 'video';
  title: string;
  isDefault: boolean;
}

export interface MaterialProfile {
  materialVideoInfoList: MaterialVideoInfo[];
  // 基础信息
  id: string;
  userId: string;
  name: string;
  age: number;
  height: number; // cm
  weight: number; // kg
  gender: GenderType;
  shoeSize: number; // 鞋码
  // 求职意向
  employType: EmployType; // 工作类型
  fullTimeMinPrice: number; // 全职期望薪资下限
  fullTimeMaxPrice: number; // 全职期望薪资上限
  partyTimeMinPrice: number; // 兼职期望薪资下限
  partyTimeMaxPrice: number; // 兼职期望薪资上限
  cityCodes: string; // 城市。多个城市用 、分割，如 '110100、141100'
  acceptWorkForSit: boolean; // 是否接受坐班
  // 直播经验
  workedYear: WorkedYears; // 工作年限，单位年，无为0、半年 0.5、1、2、3、4、5年及以上用100表示，默认为1年
  workedAccounts: string; // 直播过的账号
  newAccountExperience: number; // 是否有起号经验，0无 1有
  workedCategory: string; // 直播过的品类
  workedSecCategoryStr: string; // 直播过的二级品类
  style: string; // 风格。多个分割用 、分割
  maxGmv: number; // 最高 GMV，单位 w
  maxOnline: number; // 最高在线人数
  // 自身优势
  advantages: string;
  // 其他
  approveStatus: boolean; // 审核状态：0 待审 ，1 成功 ，2 不通过
  isOpen: boolean; // 是否开放 1开放 0不开放
  userOpen: boolean;
  adminOpen: boolean;
  createType: ProfileCreateSource;
  creator: string; // 创建人id
  progressBar: number; // 进度百分比
  filledItems: number; // 已填资料项数
  created: number; // 时间戳
  updated: number; // 时间戳
}

export interface AnchorInfo {
  // 基础信息
  materialVideoInfoList: MaterialVideoInfo[];
  id: string;
  userId: string;
  cover: string;
  name: string;
  age: number;
  height: number;
  weight: number;
  gender: GenderType;
  shoeSize: number;
  employType: EmployType;
  fullTimeMinPrice: number;
  fullTimeMaxPrice: number;
  partyTimeMinPrice: number;
  partyTimeMaxPrice: number;
  cityCodes: string;
  workedYear: WorkedYears;
  workedCategory: string;
  workedSecCategoryStr: string;
  distance: number;
  isRead: boolean;
  lastOnlineTime: number;
  updated: number;
  created: number;
  sortTime: number;
}

export interface GetVideoInfoRequest {
  sourcePath: string;
  type: 'VIDEO' | 'IMAGE';
}

export interface UploadVideoResult {
  id: string;
  url: string; // 视频地址
  coverUrl: string; // 封面地址
}

export interface IAnchorFilters {
  gender?: GenderType;
  employType?: EmployType;
  lowPriceForFullTime?: number;
  highPriceForFullTime?: number;
  lowPriceForPartyTime?: number;
  highPriceForPartyTime?: number;
  category?: string;
  readType?: AnchorReadType;
}

export interface GetAnchorListRequest extends IAnchorFilters, IPaginationRequest {
  // sortId?: string; // 排序 id，首次调用不传，分页时传上一页的最后记录的id
  jobId?: string;
  cityCode?: string;
  sortType?: AnchorSortType; // 排序规则
  latitude?: number; // 纬度，浮点数，范围为-90~90，负数表示南纬
  longitude?: number; // 经度，范围为-180~180，负数表示西经
}

export interface GetAnchorListResponse extends IPaginationResponse {
  data: AnchorInfo[];
}

export interface GetReadProfileRequest {
  resumeId: string;
  jobId?: string;
}

export interface GetShareProfileRequest {
  shareCode: string;
  resumeId: string;
}

export interface UpdateProfileStatusRequest {
  resumeId: string;
  userId: string;
  userOpen: boolean;
}
