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

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

/// Authoritative task rows.
@DataClassName('TaskRow')
class Tasks extends Table {
  /// Returns the derived `id` 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 id => text()();

  /// 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 `title` 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 title => text()();

  /// 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 `parentId` 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 parentId => text().named('parent_id').nullable()();

  /// Returns the derived `type` 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 type => text()();

  /// Returns the derived `status` 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 status => text()();

  /// Returns the derived `priority` 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 priority => text().nullable()();

  /// Returns the derived `reward` 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 reward => text()();

  /// Returns the derived `difficulty` 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 difficulty => text()();

  /// Returns the derived `durationMinutes` 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 durationMinutes =>
      integer().named('duration_minutes').nullable()();

  /// Returns the derived `scheduledStartUtc` 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 scheduledStartUtc =>
      dateTime().named('scheduled_start_utc').nullable()();

  /// Returns the derived `scheduledEndUtc` 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 scheduledEndUtc =>
      dateTime().named('scheduled_end_utc').nullable()();

  /// Returns the derived `actualStartUtc` 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 actualStartUtc =>
      dateTime().named('actual_start_utc').nullable()();

  /// Returns the derived `actualEndUtc` 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 actualEndUtc =>
      dateTime().named('actual_end_utc').nullable()();

  /// Returns the derived `completedAtUtc` 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 completedAtUtc =>
      dateTime().named('completed_at_utc').nullable()();

  /// Converts scheduler data for `backlogTagsJson` 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 backlogTagsJson => text().named('backlog_tags_json')();

  /// Returns the derived `reminderOverride` 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 reminderOverride =>
      text().named('reminder_override').nullable()();

  /// Converts scheduler data for `statsJson` 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 statsJson => text().named('stats_json')();

  /// Returns the derived `backlogEnteredAtUtc` 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 backlogEnteredAtUtc =>
      dateTime().named('backlog_entered_at_utc').nullable()();

  /// Returns the derived `backlogEnteredProvenance` 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 backlogEnteredProvenance =>
      text().named('backlog_entered_provenance').nullable()();

  /// 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 => {id};
}
