NepaliCalendarPolicy
When one institution is closed, and what its calendar has on it: the days of the week it never opens, plus the events it keeps.
The two travel together because they answer the same question, and an app that states them once gets both a calendar that paints the right days and arithmetic that counts the right ones. An office in Nepal is NepaliCalendarPolicy(provider = myEvents), closed Saturdays. A school closed Saturday and Sunday is NepaliCalendarPolicy(setOf(7, 1), myEvents). Two institutions with different lists are two policies over two providers, and a national list shared by both is national + ownList (see plus).
Nothing here blocks a date on its own. asSelectableDates turns the policy into a picker rule when that is what you want, so marking a day and refusing it stay separate decisions.
Throws
if weeklyOffDays holds a number that is not a day of the week. Other calendars number Sunday 0, and a set written to that convention would quietly close nothing, so it is rejected at construction rather than at the end of a month of wrong answers.
Constructors
Properties
the events the institution keeps. Defaults to NoOpEventProvider, which is the right value while an app has only its weekly rule wired.
days of the week the institution is closed, 1 for Sunday through 7 for Saturday. Defaults to NepaliWeekend.Default, the single Saturday weekend Nepal observes. An empty set is an institution that never closes for the week alone.
Functions
The policy as a picker rule: every closed day becomes unselectable. Opt in to this when a screen should refuse the days it marks, and leave it out when the days are only to be seen.
Two policies are equal when they describe the same institution: the same weekly off days over a provider equal to the other's. A provider that compares by value therefore keeps a rebuilt policy equal to the last one, which is what lets a Compose decorator be remembered across recompositions instead of rebuilt.
The events on date, strongest NepaliEventKind first, or an empty list when the day carries none. A weekly off day with nothing named on it answers empty.
Whether the institution is closed on date, for either reason. A day that is both a weekly off day and a holiday is closed once, and a day carrying only an observance is still worked.
Whether dayOfWeek (1 for Sunday through 7 for Saturday) is one of the institution's weekly off days. Takes the day of the week rather than a date because a calendar grid already knows it, and resolving it again would cost a conversion per cell.
Every day of one Bikram Sambat month, in day order: index 0 is day 1.
What date is under this policy: whether the week makes it a day off, and what is named on it. Resolves the day of the week through the conversion table, so prefer monthStatus when laying out a whole month.