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

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

/// Recurring and one-off locked-time rows.
@DataClassName('LockedBlockRow')
class LockedBlocks 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 `name` 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 name => text()();

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

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

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

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

  /// Returns the derived `hiddenByDefault` 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 hiddenByDefault => boolean().named('hidden_by_default')();

  /// 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').nullable()();

  /// Returns the derived `archivedAtUtc` 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 archivedAtUtc =>
      dateTime().named('archived_at_utc').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};
}
