import { REQUEST_BASE_URL } from '@/env';

export namespace Neusoft {
  export type BaseResp<T extends Record<string, unknown>> = {
    code: number;
    msg: string;
  } & T;
  export type ExtraFields = {
    searchValue: string | null;
    createBy: string | null;
    createTime: string | null;
    updateBy: string | null;
    updateTime: string;
    remark: string | null;
    params: Record<string, unknown>;
  };
  export type PagedResp<T extends Record<string, unknown>> = BaseResp<{
    rows: T[];
    total: number;
  }>;
  export type DataResp<T extends Record<string, unknown>> = BaseResp<{
    data: T;
  }>;
}
export namespace Neusoft.SmartParty {
  export type Gallery = ExtraFields & {
    id: number;
    hotNewsId: number;
    imageUrl: string;
    imageName: string;
  };
  export type GalleryResp = PagedResp<Gallery>;
}
export namespace Neusoft {
  export const SMART_PARTY_BASE_URL = `${REQUEST_BASE_URL}/neusoft`;
  export const isSucceed = (resp: BaseResp<{}>) => resp.code >= 200 && resp.code < 300;
}
