// SPDX-FileCopyrightText: 2026 FocusFlow contributors
// SPDX-License-Identifier: AGPL-3.0-only

part of '../../../scheduler_db.dart';

/// Project-level aggregate statistics rows.
@DataClassName('ProjectStatisticsRow')
class ProjectStatisticsTable extends Table {
  /// Returns the derived `tableName` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  @override
  String get tableName => 'project_statistics';

  /// Returns the derived `projectId` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  TextColumn get projectId => text().named('project_id')();

  /// Returns the derived `ownerId` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  TextColumn get ownerId => text().named('owner_id')();

  /// Returns the derived `completedTaskCount` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  IntColumn get completedTaskCount => integer().named('completed_task_count')();

  /// Converts scheduler data for `durationMinuteCountsJson` without changing the source object.
  /// Conversion helpers keep persistence and export shapes explicit so domain models do not depend on storage-specific details.
  TextColumn get durationMinuteCountsJson =>
      text().named('duration_minute_counts_json')();

  /// Converts scheduler data for `completionTimeBucketCountsJson` without changing the source object.
  /// Conversion helpers keep persistence and export shapes explicit so domain models do not depend on storage-specific details.
  TextColumn get completionTimeBucketCountsJson =>
      text().named('completion_time_bucket_counts_json')();

  /// Returns the derived `totalPushesBeforeCompletion` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  IntColumn get totalPushesBeforeCompletion =>
      integer().named('total_pushes_before_completion')();

  /// Returns the derived `completedAfterPushCount` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  IntColumn get completedAfterPushCount =>
      integer().named('completed_after_push_count')();

  /// Converts scheduler data for `rewardCountsJson` without changing the source object.
  /// Conversion helpers keep persistence and export shapes explicit so domain models do not depend on storage-specific details.
  TextColumn get rewardCountsJson => text().named('reward_counts_json')();

  /// Converts scheduler data for `difficultyCountsJson` without changing the source object.
  /// Conversion helpers keep persistence and export shapes explicit so domain models do not depend on storage-specific details.
  TextColumn get difficultyCountsJson =>
      text().named('difficulty_counts_json')();

  /// Converts scheduler data for `reminderProfileCountsJson` without changing the source object.
  /// Conversion helpers keep persistence and export shapes explicit so domain models do not depend on storage-specific details.
  TextColumn get reminderProfileCountsJson =>
      text().named('reminder_profile_counts_json')();

  /// Returns the derived `revision` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  IntColumn get revision => integer()();

  /// Returns the derived `createdAtUtc` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  DateTimeColumn get createdAtUtc => dateTime().named('created_at_utc')();

  /// Returns the derived `updatedAtUtc` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  DateTimeColumn get updatedAtUtc => dateTime().named('updated_at_utc')();

  /// Returns the derived `primaryKey` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  @override
  Set<Column<Object>> get primaryKey => {projectId};
}
