<?php

namespace SugarCalendarBookings\Availability;

use SugarCalendarBookings\Support\Helpers\Date;

/**
 * Working schedule defaults.
 *
 * @since 1.0.0
 */
class WorkingScheduleDefaults {

	/**
	 * Get the default regular working schedule.
	 *
	 * @since 1.0.0
	 *
	 * @return array<string, mixed>
	 */
	public static function get_regular() {

		$default_working_time_slot = [
			'start' => 540, // 09:00.
			'end'   => 1020, // 17:00.
		];

		return [
			[
				'type'    => 'weekday',
				'weekday' => 1,
				'periods' => [ $default_working_time_slot ],
			],
			[
				'type'    => 'weekday',
				'weekday' => 2,
				'periods' => [ $default_working_time_slot ],
			],
			[
				'type'    => 'weekday',
				'weekday' => 3,
				'periods' => [ $default_working_time_slot ],
			],
			[
				'type'    => 'weekday',
				'weekday' => 4,
				'periods' => [ $default_working_time_slot ],
			],
			[
				'type'    => 'weekday',
				'weekday' => 5,
				'periods' => [ $default_working_time_slot ],
			],
			[
				'type'    => 'weekday',
				'weekday' => 6,
				'periods' => [],
			],
			[
				'type'    => 'weekday',
				'weekday' => 7,
				'periods' => [],
			],
		];
	}

	/**
	 * Get the default overrides working schedule.
	 *
	 * @since 1.0.0
	 *
	 * @return array<string, mixed>
	 */
	public static function get_overrides() {

		return [];
	}

	/**
	 * Get the default timezone.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public static function get_timezone() {

		return Date::get_default_timezone_string();
	}

	/**
	 * Get the default working schedule as an array.
	 *
	 * @since 1.0.0
	 *
	 * @return array<string, mixed>
	 */
	public static function to_array() {

		return [
			'regular'   => self::get_regular(),
			'overrides' => self::get_overrides(),
			'timezone'  => self::get_timezone(),
		];
	}
}
