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

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

/// Owner-level settings rows.
@DataClassName('SettingsRow')
class SettingsTable 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 => 'settings';

  /// 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 `timeZoneId` 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 timeZoneId => text().named('timezone_id')();

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

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

  /// Returns the derived `compactMode` 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.
  BoolColumn get compactMode => boolean().named('compact_mode')();

  /// Converts scheduler data for `backlogStalenessJson` 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 backlogStalenessJson =>
      text().named('backlog_staleness_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 => {ownerId};
}
