import {request} from "@/api/request";

export type BrandRecord = {
  logo: string;
  name: string;
  id: number
  introductory_video: string
  brand_album: string
  graphic_introduction: string
  disabled: number
  introductory_video_resource: any
  article_count: number
  created_at: string
  page_view:number
}
export type ArticleRecord = {
  title: string
  page_view: number
  created_at: string
  content: string
  brands: BrandRecord[]
}

export const brandApi = {
  /** 品牌列表 */
  list(page: number, page_size: number) {
    return request<{
      list: BrandRecord[],
      total: number
    }>(`/home/v1/brand/list?page=${page}&page_size=${page_size}`, "GET")
  },
  /** 品牌详情 */
  info(id: number) {
    return request<BrandRecord>(`/home/v1/brand/${id}`, "GET")
  },
  /** 文章列表 */
  articleList(owner_id: number, page: number) {
    return request<{
      list: ArticleRecord[],
      total: number
    }>(`/home/v1/article/list?owner_id=${owner_id}&page=${page}&page_size=10`, "GET")
  },
  articleInfo(id: number) {
    return request<ArticleRecord>(`/home/v1/article/${id}`, "GET")
  },
}
