import { CalendarPeriod } from './calendar-period.abstract';
import { CalendarDate } from '../calendar-date';
/**
 * Period of the week
 */
export class WeekPeriod extends CalendarPeriod {
  constructor(current, showWeekends, timezone) {
    super(WeekPeriod.DISPLAY_DATE_COUNT, current, timezone);
    this._type = 'week';
    this._showWeekends = true;
    this._showWeekends = showWeekends === false ? false : true;
  }
  /**
   * @inheritDoc
   */
  next() {
    const currentDate = this.current.toDate();
    currentDate.setDate(currentDate.getDate() + 7);
    return this.createBy(CalendarDate.from(currentDate));
  }
  /**
   * @inheritDoc
   */
  previous() {
    const currentDate = this.current.toDate();
    currentDate.setDate(currentDate.getDate() - 7);
    return this.createBy(CalendarDate.from(currentDate));
  }
  /**
   * @inheritDoc
   */
  createBy(current) {
    return new WeekPeriod(current, this._showWeekends, this.timezone);
  }
}
WeekPeriod.DISPLAY_DATE_COUNT = 7;
