import { DatePicker } from '@/apps/portal/shared/components/inputs/DatePicker';
import { BaseComponent } from '@/shared/modules/base/components/BaseComponent';
import { formatDate } from '@/shared/utils/format-utils';

export class BookingMoveInDateSection extends BaseComponent {
  private readonly moveInDatePicker = new DatePicker(this.host.getByTestId('date-picker'));
  private readonly nextSectionButton = this.host.getByTestId('next-section-button');

  async select(moveInDate: Date): Promise<void> {
    formatDate(moveInDate) !== formatDate(new Date()) && (await this.moveInDatePicker.select(moveInDate));
    await this.nextSectionButton.click();
  }
}
