# info.summary
Calendar API for Moroccan Holidays and Open Business Days

# info.description
## Try Calendar API

This interactive panel allows you to explore the whole API and to understand the different datastructures and parameters
used by every endpoint. You can also test every **active** APIKey you have.

## Setup your APIKey

Copy any **active** APIKey from your console and set it in the `Authentication` side panel.

That's it :-), now you can explore any endpoint

## Holidays

This API allows to list, search and check if a `date` is a Moroccan holiday.

| Endpoint                 |                                                                                                                        Description |
| ------------------------ | :--------------------------------------------------------------------------------------------------------------------------------- |
| **/holidays/is-holiday** |                                                                                          Checks if a date is an `Official` Holiday |
| **/holidays/{year}**     |                                                                                                     List the holidays of the year. |
| **/holidays**            |  Lists all national Holidays. Since Morocco is a Kingdom, there are some Holidays that depend on the birthday of the current King. |

**N.B:**
Please note that if it's a **future** `year`, the **religious holidays** are `Estimated` and not official because they depend on the moon sighting.

Once confirmed, the Holiday becomes `Official` and the adequate flag will be updated accordingly.

## Business Days (bdays)

This API calculates the `next` and `previous` **Open Business Day** of a date. You can also get the Open Days for a whole year or any month of a year

| Endpoint                  | Description                                                                                     |
| ------------------------- | ----------------------------------------------------------------------------------------------- |
| **/bdays/{year}**         | Generate the Business days for the whole `year`                                                 |
| **/bdays/{year}/{month}** | Generate the Business days of a `month` of the `year`                                           |
| **/bdays/next**           | Calculate **the next** Open day relative to the provided `date`                                 |
| **/bdays/previous**       | Calculate **the previous** Open day relative to the provided `date`                             |
| **/bdays/count**          | Count the business days between 2 dates (included)                                              |
| **/bdays/between**        | List the business days between 2 dates (included)                                               |
| **/bdays/span/month**     | Calculate the interval (Start/End date) of a `month`. i.e: Interval of the month 5 of year 2025 |
| **/bdays/span/quarter**   | Calculate the interval (Start/End date) of a `quarter`. i.e: Interval of the Q2 of year 2024    |
| **/bdays/span/semester**  | Calculate the interval (Start/End date) of a `semester`. i.e: Interval of the S1 of year 2026   |
| **/bdays/span/year**      | Calculate the interval (Start/End date) of the `year`. i.e: Interval of the year 2021           |


## Data dictionary

### Holiday Type:

| Value           |                                                                  Description |
| --------------- | :--------------------------------------------------------------------------- |
| **National**    |                                               The date is a national Holiday |
| **Religious**   |  The date is a Religious Holiday (Check the status if it's Confirmed or not) |
| **Exceptional** |                                           The date is an exceptional Holiday |

### HolidayStatus (status)

| Value         |                                                Description |
| ------------- | :--------------------------------------------------------- |
| **Official**  |                                    The Holiday is Official |
| **Estimated** |  Religious Holidays are estimated before the moon sighting |

# paths./api/v1/bdays/{year}/{month}.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/next.get.parameters[].examples.adate-example-1.summary
Day before a holiday `fête de l'independance`

# paths./api/v1/bdays/next.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/previous.get.parameters[].examples.adate-example-1.summary
Day after a holiday `fête de l'independance`

# paths./api/v1/bdays/previous.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/{year}.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/count.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/between.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/span/month.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/span/quarter.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/span/semester.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/bdays/span/year.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/holidays.get.parameters[].schema.description
Case insensitive textual search. Supports wildcards. NB: Accents are respected

# paths./api/v1/holidays.get.parameters[].description
Case insensitive textual search. Supports wildcards. NB: Accents are respected

# paths./api/v1/holidays.get.parameters[].description
There are Three Types of holidays:
- **Religious**: Include only Religious holidays. i.e: Eid el fitr, ...
- **National**: Include only National holidays. i.e: Fête du travail, Fête du trône, ...
- **Exceptional**: Include only Exceptional holidays.
- **ND::Null**: Disable this filter

# paths./api/v1/holidays.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/holidays/{year}.get.parameters[].schema.description
Case insensitive textual search. Supports wildcards. NB: Accents are respected

# paths./api/v1/holidays/{year}.get.parameters[].description
Case insensitive textual search. Supports wildcards. NB: Accents are respected

# paths./api/v1/holidays/{year}.get.parameters[].description
There are Three Types of holidays:
- **Religious**: Include only Religious holidays. i.e: Eid el fitr, ...
- **National**: Include only National holidays. i.e: Fête du travail, Fête du trône, ...
- **Exceptional**: Include only Exceptional holidays.
- **ND::Null**: Disable this filter

# paths./api/v1/holidays/{year}.get.responses.400.description
Bad request syntax or unsupported method

# paths./api/v1/holidays/is-holiday.get.responses.400.description
Bad request syntax or unsupported method

# components.schemas.CalFreq.description
Frequency

    Enums:
        - D: DAILY
        - W: WEEKLY
        - M: MONTHLY
        - Q: QUARTERLY
        - S: SEMI-ANNUALLY
        - Y: YEARLY
    

# components.schemas.CalHolidayStatus.description
Represents the status of religious holidays which are based on moon sightings.

    At the start of the year, Religious holydays are **Estimated**. When the official moon sighting is confirmed the status is changed to **Official**

    NB: The change may **shift the `Estimated` date by ONE DAY**

    All other Holiday types are Official by default

    Attributes:
        - ND: Not defined for the entity or unknown by us (very unlikely)
        - Official (str): The holiday is validated and thus Official
        - Estimated (str): The holiday is estimated before the moon sighting
    

# components.schemas.CalHolidayType.description
There are Three Types of holidays:
- **Religious**: Include only Religious holidays. i.e: Eid el fitr, ...
- **National**: Include only National holidays. i.e: Fête du travail, Fête du trône, ...
- **Exceptional**: Include only Exceptional holidays.
- **ND::Null**: Disable this filter

# components.schemas.CalMode.description
The Mode used by the Fin Calendar to calulate the reference dates of dynamic periods. i.e: 3:M, 23:W, 12:Y, ...

    Enums:
    - D: The calculation is based on open `dailies` dates. Similar to any Business days based calendar
    - W: The calculation is based on the `weeklies` (**Fridays**). Returns the last weekdate related to the provided `period`
    

# components.securitySchemes.apiKey.description
API Key authentication and authorization.

# tags[].description
National holidays of any year and Religious holidays of past years