// src/server/features/operations/db/daily_cleaning_schedule.table.ts
// Daily cleaning schedule table schema for tracking room cleaning tasks

import { mysqlTable, varchar, int, timestamp, boolean, date, uniqueIndex } from 'drizzle-orm/mysql-core';

export const dailyCleaningSchedule = mysqlTable('daily_cleaning_schedule', {
  id: varchar('id', { length: 36 }).primaryKey(),

  date: date('date', { mode: 'string' }).notNull(),

  roomId: varchar('room_id', { length: 10 }).notNull(),
  roomType: varchar('room_type', { length: 100 }).notNull(),
  bedsCount: int('beds_count').notNull().default(0),

  isCleaned: boolean('is_cleaned').notNull().default(false),
  cleanerName: varchar('cleaner_name', { length: 255 }),
  comment: varchar('comment', { length: 500 }),

  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
}, (table) => ({
  unq: uniqueIndex('cleaning_date_room_idx').on(table.date, table.roomId),
}));
