/**
 * 仪表板趋势数据仓储接口
 */
export const DASHBOARD_TREND_DATA_REPOSITORY = Symbol(
  'DASHBOARD_TREND_DATA_REPOSITORY',
);

export interface DashboardTrendDataItem {
  id?: bigint;
  trendDate: Date;
  plantingCount: number;
  orderCount: number;
  newUserCount: number;
  activeUserCount: number;
  createdAt?: Date;
  updatedAt?: Date;
}

export interface IDashboardTrendDataRepository {
  /**
   * 保存或更新趋势数据
   */
  save(data: DashboardTrendDataItem): Promise<DashboardTrendDataItem>;

  /**
   * 批量保存趋势数据
   */
  saveMany(dataList: DashboardTrendDataItem[]): Promise<number>;

  /**
   * 根据ID查找
   */
  findById(id: bigint): Promise<DashboardTrendDataItem | null>;

  /**
   * 根据日期查找
   */
  findByDate(date: Date): Promise<DashboardTrendDataItem | null>;

  /**
   * 获取最近N天的趋势数据
   */
  findRecentDays(days: number): Promise<DashboardTrendDataItem[]>;

  /**
   * 获取日期范围内的趋势数据
   */
  findByDateRange(
    startDate: Date,
    endDate: Date,
  ): Promise<DashboardTrendDataItem[]>;

  /**
   * 删除指定日期之前的数据
   */
  deleteBeforeDate(date: Date): Promise<number>;
}
