Introduce Alarm, Timer and their transitive deps
Relnote: Added Alarm, Intangible, Schedule and Timer Built-in Types
Test: Tested copying preserves polymorphic type
Change-Id: Ia1dc9c6c2469b6cfca849d34c149a86d98fc6c72
diff --git a/appactions/builtintypes/builtintypes-core/api/current.txt b/appactions/builtintypes/builtintypes-core/api/current.txt
index a3775c3..6c91e2b 100644
--- a/appactions/builtintypes/builtintypes-core/api/current.txt
+++ b/appactions/builtintypes/builtintypes-core/api/current.txt
@@ -1,6 +1,22 @@
// Signature format: 4.0
package androidx.appactions.builtintypes.properties {
+ public final class ByDay {
+ ctor public ByDay(String text);
+ ctor public ByDay(androidx.appactions.builtintypes.types.DayOfWeek dayOfWeek);
+ method public androidx.appactions.builtintypes.types.DayOfWeek? getAsDayOfWeek();
+ method public String? getAsText();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.ByDay.Mapper<R> mapper);
+ property public final androidx.appactions.builtintypes.types.DayOfWeek? asDayOfWeek;
+ property public final String? asText;
+ }
+
+ public static interface ByDay.Mapper<R> {
+ method public default R dayOfWeek(androidx.appactions.builtintypes.types.DayOfWeek instance);
+ method public R orElse();
+ method public default R text(String instance);
+ }
+
public final class DisambiguatingDescription {
ctor public DisambiguatingDescription(String text);
ctor public DisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription.CanonicalValue canonicalValue);
@@ -22,16 +38,342 @@
method public default R text(String instance);
}
+ public final class EndDate {
+ ctor public EndDate(java.time.LocalDate date);
+ ctor public EndDate(java.time.LocalDateTime localDateTime);
+ ctor public EndDate(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDate? getAsDate();
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.EndDate.Mapper<R> mapper);
+ property public final java.time.LocalDate? asDate;
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface EndDate.Mapper<R> {
+ method public default R date(java.time.LocalDate instance);
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
+ public final class EndTime {
+ ctor public EndTime(java.time.LocalTime time);
+ ctor public EndTime(java.time.LocalDateTime localDateTime);
+ ctor public EndTime(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.LocalTime? getAsTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.EndTime.Mapper<R> mapper);
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.LocalTime? asTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface EndTime.Mapper<R> {
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R time(java.time.LocalTime instance);
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
+ public final class ExceptDate {
+ ctor public ExceptDate(java.time.LocalDate date);
+ ctor public ExceptDate(java.time.LocalDateTime localDateTime);
+ ctor public ExceptDate(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDate? getAsDate();
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.ExceptDate.Mapper<R> mapper);
+ property public final java.time.LocalDate? asDate;
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface ExceptDate.Mapper<R> {
+ method public default R date(java.time.LocalDate instance);
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
public final class Name {
ctor public Name(String text);
method public String? getAsText();
property public final String? asText;
}
+ public final class RepeatFrequency {
+ ctor public RepeatFrequency(java.time.Duration duration);
+ ctor public RepeatFrequency(String text);
+ method public java.time.Duration? getAsDuration();
+ method public String? getAsText();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.RepeatFrequency.Mapper<R> mapper);
+ property public final java.time.Duration? asDuration;
+ property public final String? asText;
+ }
+
+ public static interface RepeatFrequency.Mapper<R> {
+ method public default R duration(java.time.Duration instance);
+ method public R orElse();
+ method public default R text(String instance);
+ }
+
+ public final class StartDate {
+ ctor public StartDate(java.time.LocalDate date);
+ ctor public StartDate(java.time.LocalDateTime localDateTime);
+ ctor public StartDate(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDate? getAsDate();
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.StartDate.Mapper<R> mapper);
+ property public final java.time.LocalDate? asDate;
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface StartDate.Mapper<R> {
+ method public default R date(java.time.LocalDate instance);
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
+ public final class StartTime {
+ ctor public StartTime(java.time.LocalTime time);
+ ctor public StartTime(java.time.LocalDateTime localDateTime);
+ ctor public StartTime(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.LocalTime? getAsTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.StartTime.Mapper<R> mapper);
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.LocalTime? asTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface StartTime.Mapper<R> {
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R time(java.time.LocalTime instance);
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
}
package androidx.appactions.builtintypes.types {
+ public interface Alarm extends androidx.appactions.builtintypes.types.Thing {
+ method public default static androidx.appactions.builtintypes.types.Alarm.Builder<?> Builder();
+ method public androidx.appactions.builtintypes.types.Schedule? getAlarmSchedule();
+ method public androidx.appactions.builtintypes.types.Alarm.Builder<?> toBuilder();
+ property public abstract androidx.appactions.builtintypes.types.Schedule? alarmSchedule;
+ field public static final androidx.appactions.builtintypes.types.Alarm.Companion Companion;
+ }
+
+ public static interface Alarm.Builder<Self extends androidx.appactions.builtintypes.types.Alarm.Builder<Self>> extends androidx.appactions.builtintypes.types.Thing.Builder<Self> {
+ method public androidx.appactions.builtintypes.types.Alarm build();
+ method public Self setAlarmSchedule(androidx.appactions.builtintypes.types.Schedule? schedule);
+ method public default Self setDisambiguatingDescription(androidx.appactions.builtintypes.types.Alarm.DisambiguatingDescriptionValue canonicalValue);
+ }
+
+ public static final class Alarm.Companion {
+ method public androidx.appactions.builtintypes.types.Alarm.Builder<?> Builder();
+ }
+
+ public static final class Alarm.DisambiguatingDescriptionValue extends androidx.appactions.builtintypes.properties.DisambiguatingDescription.CanonicalValue {
+ method public String getTextValue();
+ property public String textValue;
+ field public static final androidx.appactions.builtintypes.types.Alarm.DisambiguatingDescriptionValue.Companion Companion;
+ field public static final androidx.appactions.builtintypes.types.Alarm.DisambiguatingDescriptionValue FAMILY_BELL;
+ }
+
+ public static final class Alarm.DisambiguatingDescriptionValue.Companion {
+ }
+
+ public final class DayOfWeek {
+ method public String getCanonicalUrl();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.types.DayOfWeek.Mapper<R> mapper);
+ property public final String canonicalUrl;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek.Companion Companion;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek FRIDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek MONDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek PUBLIC_HOLIDAYS;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek SATURDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek SUNDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek THURSDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek TUESDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek WEDNESDAY;
+ }
+
+ public static final class DayOfWeek.Companion {
+ }
+
+ public static interface DayOfWeek.Mapper<R> {
+ method public default R friday();
+ method public default R monday();
+ method public R orElse();
+ method public default R publicHolidays();
+ method public default R saturday();
+ method public default R sunday();
+ method public default R thursday();
+ method public default R tuesday();
+ method public default R wednesday();
+ }
+
+ public abstract class GenericAlarm<Self extends androidx.appactions.builtintypes.types.GenericAlarm<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericAlarm.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Alarm {
+ ctor public GenericAlarm(androidx.appactions.builtintypes.types.Alarm alarm);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final androidx.appactions.builtintypes.types.Schedule? getAlarmSchedule();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final androidx.appactions.builtintypes.types.Schedule? alarmSchedule;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract static class GenericAlarm.Builder<Self extends androidx.appactions.builtintypes.types.GenericAlarm.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericAlarm<Built, Self>> implements androidx.appactions.builtintypes.types.Alarm.Builder<Self> {
+ ctor public GenericAlarm.Builder();
+ method public final Built build();
+ method protected abstract Built buildFromAlarm(androidx.appactions.builtintypes.types.Alarm alarm);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setAlarmSchedule(androidx.appactions.builtintypes.types.Schedule? schedule);
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract class GenericIntangible<Self extends androidx.appactions.builtintypes.types.GenericIntangible<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericIntangible.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Intangible {
+ ctor public GenericIntangible(androidx.appactions.builtintypes.types.Intangible intangible);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract static class GenericIntangible.Builder<Self extends androidx.appactions.builtintypes.types.GenericIntangible.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericIntangible<Built, Self>> implements androidx.appactions.builtintypes.types.Intangible.Builder<Self> {
+ ctor public GenericIntangible.Builder();
+ method public final Built build();
+ method protected abstract Built buildFromIntangible(androidx.appactions.builtintypes.types.Intangible intangible);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract class GenericSchedule<Self extends androidx.appactions.builtintypes.types.GenericSchedule<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericSchedule.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Schedule {
+ ctor public GenericSchedule(androidx.appactions.builtintypes.types.Schedule schedule);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final java.util.List<androidx.appactions.builtintypes.properties.ByDay> getByDays();
+ method public final java.util.List<java.lang.Long> getByMonthDays();
+ method public final java.util.List<java.lang.Long> getByMonthWeeks();
+ method public final java.util.List<java.lang.Long> getByMonths();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final androidx.appactions.builtintypes.properties.EndDate? getEndDate();
+ method public final androidx.appactions.builtintypes.properties.EndTime? getEndTime();
+ method public final androidx.appactions.builtintypes.properties.ExceptDate? getExceptDate();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method public final Long? getRepeatCount();
+ method public final androidx.appactions.builtintypes.properties.RepeatFrequency? getRepeatFrequency();
+ method public final String? getScheduleTimezone();
+ method protected abstract String getSelfTypeName();
+ method public final androidx.appactions.builtintypes.properties.StartDate? getStartDate();
+ method public final androidx.appactions.builtintypes.properties.StartTime? getStartTime();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final java.util.List<androidx.appactions.builtintypes.properties.ByDay> byDays;
+ property public final java.util.List<java.lang.Long> byMonthDays;
+ property public final java.util.List<java.lang.Long> byMonthWeeks;
+ property public final java.util.List<java.lang.Long> byMonths;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final androidx.appactions.builtintypes.properties.EndDate? endDate;
+ property public final androidx.appactions.builtintypes.properties.EndTime? endTime;
+ property public final androidx.appactions.builtintypes.properties.ExceptDate? exceptDate;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property public final Long? repeatCount;
+ property public final androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency;
+ property public final String? scheduleTimezone;
+ property protected abstract String selfTypeName;
+ property public final androidx.appactions.builtintypes.properties.StartDate? startDate;
+ property public final androidx.appactions.builtintypes.properties.StartTime? startTime;
+ }
+
+ public abstract static class GenericSchedule.Builder<Self extends androidx.appactions.builtintypes.types.GenericSchedule.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericSchedule<Built, Self>> implements androidx.appactions.builtintypes.types.Schedule.Builder<Self> {
+ ctor public GenericSchedule.Builder();
+ method public final Self addByDay(androidx.appactions.builtintypes.properties.ByDay byDay);
+ method public final Self addByDays(Iterable<androidx.appactions.builtintypes.properties.ByDay> values);
+ method public final Self addByMonth(long integer);
+ method public final Self addByMonthDay(long integer);
+ method public final Self addByMonthDays(Iterable<java.lang.Long> values);
+ method public final Self addByMonthWeek(long integer);
+ method public final Self addByMonthWeeks(Iterable<java.lang.Long> values);
+ method public final Self addByMonths(Iterable<java.lang.Long> values);
+ method public final Built build();
+ method protected abstract Built buildFromSchedule(androidx.appactions.builtintypes.types.Schedule schedule);
+ method public final Self clearByDays();
+ method public final Self clearByMonthDays();
+ method public final Self clearByMonthWeeks();
+ method public final Self clearByMonths();
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setEndDate(androidx.appactions.builtintypes.properties.EndDate? endDate);
+ method public final Self setEndTime(androidx.appactions.builtintypes.properties.EndTime? endTime);
+ method public final Self setExceptDate(androidx.appactions.builtintypes.properties.ExceptDate? exceptDate);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final Self setRepeatCount(Long? integer);
+ method public final Self setRepeatFrequency(androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency);
+ method public final Self setScheduleTimezone(String? text);
+ method public final Self setStartDate(androidx.appactions.builtintypes.properties.StartDate? startDate);
+ method public final Self setStartTime(androidx.appactions.builtintypes.properties.StartTime? startTime);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
public abstract class GenericThing<Self extends androidx.appactions.builtintypes.types.GenericThing<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericThing.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Thing {
ctor public GenericThing(androidx.appactions.builtintypes.types.Thing thing);
method public final boolean equals(Object? other);
@@ -67,6 +409,135 @@
property protected abstract String selfTypeName;
}
+ public abstract class GenericTimer<Self extends androidx.appactions.builtintypes.types.GenericTimer<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericTimer.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Timer {
+ ctor public GenericTimer(androidx.appactions.builtintypes.types.Timer timer);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final java.time.Duration? getDuration();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final java.time.Duration? duration;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract static class GenericTimer.Builder<Self extends androidx.appactions.builtintypes.types.GenericTimer.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericTimer<Built, Self>> implements androidx.appactions.builtintypes.types.Timer.Builder<Self> {
+ ctor public GenericTimer.Builder();
+ method public final Built build();
+ method protected abstract Built buildFromTimer(androidx.appactions.builtintypes.types.Timer timer);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setDuration(java.time.Duration? duration);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
+ public interface Intangible extends androidx.appactions.builtintypes.types.Thing {
+ method public default static androidx.appactions.builtintypes.types.Intangible.Builder<?> Builder();
+ method public androidx.appactions.builtintypes.types.Intangible.Builder<?> toBuilder();
+ field public static final androidx.appactions.builtintypes.types.Intangible.Companion Companion;
+ }
+
+ public static interface Intangible.Builder<Self extends androidx.appactions.builtintypes.types.Intangible.Builder<Self>> extends androidx.appactions.builtintypes.types.Thing.Builder<Self> {
+ method public androidx.appactions.builtintypes.types.Intangible build();
+ }
+
+ public static final class Intangible.Companion {
+ method public androidx.appactions.builtintypes.types.Intangible.Builder<?> Builder();
+ }
+
+ public interface Schedule extends androidx.appactions.builtintypes.types.Intangible {
+ method public default static androidx.appactions.builtintypes.types.Schedule.Builder<?> Builder();
+ method public java.util.List<androidx.appactions.builtintypes.properties.ByDay> getByDays();
+ method public java.util.List<java.lang.Long> getByMonthDays();
+ method public java.util.List<java.lang.Long> getByMonthWeeks();
+ method public java.util.List<java.lang.Long> getByMonths();
+ method public androidx.appactions.builtintypes.properties.EndDate? getEndDate();
+ method public androidx.appactions.builtintypes.properties.EndTime? getEndTime();
+ method public androidx.appactions.builtintypes.properties.ExceptDate? getExceptDate();
+ method public Long? getRepeatCount();
+ method public androidx.appactions.builtintypes.properties.RepeatFrequency? getRepeatFrequency();
+ method public String? getScheduleTimezone();
+ method public androidx.appactions.builtintypes.properties.StartDate? getStartDate();
+ method public androidx.appactions.builtintypes.properties.StartTime? getStartTime();
+ method public androidx.appactions.builtintypes.types.Schedule.Builder<?> toBuilder();
+ property public abstract java.util.List<androidx.appactions.builtintypes.properties.ByDay> byDays;
+ property public abstract java.util.List<java.lang.Long> byMonthDays;
+ property public abstract java.util.List<java.lang.Long> byMonthWeeks;
+ property public abstract java.util.List<java.lang.Long> byMonths;
+ property public abstract androidx.appactions.builtintypes.properties.EndDate? endDate;
+ property public abstract androidx.appactions.builtintypes.properties.EndTime? endTime;
+ property public abstract androidx.appactions.builtintypes.properties.ExceptDate? exceptDate;
+ property public abstract Long? repeatCount;
+ property public abstract androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency;
+ property public abstract String? scheduleTimezone;
+ property public abstract androidx.appactions.builtintypes.properties.StartDate? startDate;
+ property public abstract androidx.appactions.builtintypes.properties.StartTime? startTime;
+ field public static final androidx.appactions.builtintypes.types.Schedule.Companion Companion;
+ }
+
+ public static interface Schedule.Builder<Self extends androidx.appactions.builtintypes.types.Schedule.Builder<Self>> extends androidx.appactions.builtintypes.types.Intangible.Builder<Self> {
+ method public default Self addByDay(String text);
+ method public default Self addByDay(androidx.appactions.builtintypes.types.DayOfWeek dayOfWeek);
+ method public Self addByDay(androidx.appactions.builtintypes.properties.ByDay byDay);
+ method public Self addByDays(Iterable<androidx.appactions.builtintypes.properties.ByDay> values);
+ method public Self addByMonth(long integer);
+ method public Self addByMonthDay(long integer);
+ method public Self addByMonthDays(Iterable<java.lang.Long> values);
+ method public Self addByMonthWeek(long integer);
+ method public Self addByMonthWeeks(Iterable<java.lang.Long> values);
+ method public Self addByMonths(Iterable<java.lang.Long> values);
+ method public androidx.appactions.builtintypes.types.Schedule build();
+ method public Self clearByDays();
+ method public Self clearByMonthDays();
+ method public Self clearByMonthWeeks();
+ method public Self clearByMonths();
+ method public default Self setEndDate(java.time.LocalDate date);
+ method public default Self setEndDate(java.time.LocalDateTime localDateTime);
+ method public default Self setEndDate(java.time.ZonedDateTime zonedDateTime);
+ method public Self setEndDate(androidx.appactions.builtintypes.properties.EndDate? endDate);
+ method public default Self setEndTime(java.time.LocalTime time);
+ method public default Self setEndTime(java.time.LocalDateTime localDateTime);
+ method public default Self setEndTime(java.time.ZonedDateTime zonedDateTime);
+ method public Self setEndTime(androidx.appactions.builtintypes.properties.EndTime? endTime);
+ method public default Self setExceptDate(java.time.LocalDate date);
+ method public default Self setExceptDate(java.time.LocalDateTime localDateTime);
+ method public default Self setExceptDate(java.time.ZonedDateTime zonedDateTime);
+ method public Self setExceptDate(androidx.appactions.builtintypes.properties.ExceptDate? exceptDate);
+ method public Self setRepeatCount(Long? integer);
+ method public default Self setRepeatFrequency(java.time.Duration duration);
+ method public default Self setRepeatFrequency(String text);
+ method public Self setRepeatFrequency(androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency);
+ method public Self setScheduleTimezone(String? text);
+ method public default Self setStartDate(java.time.LocalDate date);
+ method public default Self setStartDate(java.time.LocalDateTime localDateTime);
+ method public default Self setStartDate(java.time.ZonedDateTime zonedDateTime);
+ method public Self setStartDate(androidx.appactions.builtintypes.properties.StartDate? startDate);
+ method public default Self setStartTime(java.time.LocalTime time);
+ method public default Self setStartTime(java.time.LocalDateTime localDateTime);
+ method public default Self setStartTime(java.time.ZonedDateTime zonedDateTime);
+ method public Self setStartTime(androidx.appactions.builtintypes.properties.StartTime? startTime);
+ }
+
+ public static final class Schedule.Companion {
+ method public androidx.appactions.builtintypes.types.Schedule.Builder<?> Builder();
+ }
+
public interface Thing {
method public default static androidx.appactions.builtintypes.types.Thing.Builder<?> Builder();
method public androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
@@ -92,5 +563,22 @@
method public androidx.appactions.builtintypes.types.Thing.Builder<?> Builder();
}
+ public interface Timer extends androidx.appactions.builtintypes.types.Thing {
+ method public default static androidx.appactions.builtintypes.types.Timer.Builder<?> Builder();
+ method public java.time.Duration? getDuration();
+ method public androidx.appactions.builtintypes.types.Timer.Builder<?> toBuilder();
+ property public abstract java.time.Duration? duration;
+ field public static final androidx.appactions.builtintypes.types.Timer.Companion Companion;
+ }
+
+ public static interface Timer.Builder<Self extends androidx.appactions.builtintypes.types.Timer.Builder<Self>> extends androidx.appactions.builtintypes.types.Thing.Builder<Self> {
+ method public androidx.appactions.builtintypes.types.Timer build();
+ method public Self setDuration(java.time.Duration? duration);
+ }
+
+ public static final class Timer.Companion {
+ method public androidx.appactions.builtintypes.types.Timer.Builder<?> Builder();
+ }
+
}
diff --git a/appactions/builtintypes/builtintypes-core/api/restricted_current.txt b/appactions/builtintypes/builtintypes-core/api/restricted_current.txt
index a3775c3..6c91e2b 100644
--- a/appactions/builtintypes/builtintypes-core/api/restricted_current.txt
+++ b/appactions/builtintypes/builtintypes-core/api/restricted_current.txt
@@ -1,6 +1,22 @@
// Signature format: 4.0
package androidx.appactions.builtintypes.properties {
+ public final class ByDay {
+ ctor public ByDay(String text);
+ ctor public ByDay(androidx.appactions.builtintypes.types.DayOfWeek dayOfWeek);
+ method public androidx.appactions.builtintypes.types.DayOfWeek? getAsDayOfWeek();
+ method public String? getAsText();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.ByDay.Mapper<R> mapper);
+ property public final androidx.appactions.builtintypes.types.DayOfWeek? asDayOfWeek;
+ property public final String? asText;
+ }
+
+ public static interface ByDay.Mapper<R> {
+ method public default R dayOfWeek(androidx.appactions.builtintypes.types.DayOfWeek instance);
+ method public R orElse();
+ method public default R text(String instance);
+ }
+
public final class DisambiguatingDescription {
ctor public DisambiguatingDescription(String text);
ctor public DisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription.CanonicalValue canonicalValue);
@@ -22,16 +38,342 @@
method public default R text(String instance);
}
+ public final class EndDate {
+ ctor public EndDate(java.time.LocalDate date);
+ ctor public EndDate(java.time.LocalDateTime localDateTime);
+ ctor public EndDate(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDate? getAsDate();
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.EndDate.Mapper<R> mapper);
+ property public final java.time.LocalDate? asDate;
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface EndDate.Mapper<R> {
+ method public default R date(java.time.LocalDate instance);
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
+ public final class EndTime {
+ ctor public EndTime(java.time.LocalTime time);
+ ctor public EndTime(java.time.LocalDateTime localDateTime);
+ ctor public EndTime(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.LocalTime? getAsTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.EndTime.Mapper<R> mapper);
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.LocalTime? asTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface EndTime.Mapper<R> {
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R time(java.time.LocalTime instance);
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
+ public final class ExceptDate {
+ ctor public ExceptDate(java.time.LocalDate date);
+ ctor public ExceptDate(java.time.LocalDateTime localDateTime);
+ ctor public ExceptDate(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDate? getAsDate();
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.ExceptDate.Mapper<R> mapper);
+ property public final java.time.LocalDate? asDate;
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface ExceptDate.Mapper<R> {
+ method public default R date(java.time.LocalDate instance);
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
public final class Name {
ctor public Name(String text);
method public String? getAsText();
property public final String? asText;
}
+ public final class RepeatFrequency {
+ ctor public RepeatFrequency(java.time.Duration duration);
+ ctor public RepeatFrequency(String text);
+ method public java.time.Duration? getAsDuration();
+ method public String? getAsText();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.RepeatFrequency.Mapper<R> mapper);
+ property public final java.time.Duration? asDuration;
+ property public final String? asText;
+ }
+
+ public static interface RepeatFrequency.Mapper<R> {
+ method public default R duration(java.time.Duration instance);
+ method public R orElse();
+ method public default R text(String instance);
+ }
+
+ public final class StartDate {
+ ctor public StartDate(java.time.LocalDate date);
+ ctor public StartDate(java.time.LocalDateTime localDateTime);
+ ctor public StartDate(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDate? getAsDate();
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.StartDate.Mapper<R> mapper);
+ property public final java.time.LocalDate? asDate;
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface StartDate.Mapper<R> {
+ method public default R date(java.time.LocalDate instance);
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
+ public final class StartTime {
+ ctor public StartTime(java.time.LocalTime time);
+ ctor public StartTime(java.time.LocalDateTime localDateTime);
+ ctor public StartTime(java.time.ZonedDateTime zonedDateTime);
+ method public java.time.LocalDateTime? getAsLocalDateTime();
+ method public java.time.LocalTime? getAsTime();
+ method public java.time.ZonedDateTime? getAsZonedDateTime();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.properties.StartTime.Mapper<R> mapper);
+ property public final java.time.LocalDateTime? asLocalDateTime;
+ property public final java.time.LocalTime? asTime;
+ property public final java.time.ZonedDateTime? asZonedDateTime;
+ }
+
+ public static interface StartTime.Mapper<R> {
+ method public default R localDateTime(java.time.LocalDateTime instance);
+ method public R orElse();
+ method public default R time(java.time.LocalTime instance);
+ method public default R zonedDateTime(java.time.ZonedDateTime instance);
+ }
+
}
package androidx.appactions.builtintypes.types {
+ public interface Alarm extends androidx.appactions.builtintypes.types.Thing {
+ method public default static androidx.appactions.builtintypes.types.Alarm.Builder<?> Builder();
+ method public androidx.appactions.builtintypes.types.Schedule? getAlarmSchedule();
+ method public androidx.appactions.builtintypes.types.Alarm.Builder<?> toBuilder();
+ property public abstract androidx.appactions.builtintypes.types.Schedule? alarmSchedule;
+ field public static final androidx.appactions.builtintypes.types.Alarm.Companion Companion;
+ }
+
+ public static interface Alarm.Builder<Self extends androidx.appactions.builtintypes.types.Alarm.Builder<Self>> extends androidx.appactions.builtintypes.types.Thing.Builder<Self> {
+ method public androidx.appactions.builtintypes.types.Alarm build();
+ method public Self setAlarmSchedule(androidx.appactions.builtintypes.types.Schedule? schedule);
+ method public default Self setDisambiguatingDescription(androidx.appactions.builtintypes.types.Alarm.DisambiguatingDescriptionValue canonicalValue);
+ }
+
+ public static final class Alarm.Companion {
+ method public androidx.appactions.builtintypes.types.Alarm.Builder<?> Builder();
+ }
+
+ public static final class Alarm.DisambiguatingDescriptionValue extends androidx.appactions.builtintypes.properties.DisambiguatingDescription.CanonicalValue {
+ method public String getTextValue();
+ property public String textValue;
+ field public static final androidx.appactions.builtintypes.types.Alarm.DisambiguatingDescriptionValue.Companion Companion;
+ field public static final androidx.appactions.builtintypes.types.Alarm.DisambiguatingDescriptionValue FAMILY_BELL;
+ }
+
+ public static final class Alarm.DisambiguatingDescriptionValue.Companion {
+ }
+
+ public final class DayOfWeek {
+ method public String getCanonicalUrl();
+ method public <R> R mapWhen(androidx.appactions.builtintypes.types.DayOfWeek.Mapper<R> mapper);
+ property public final String canonicalUrl;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek.Companion Companion;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek FRIDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek MONDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek PUBLIC_HOLIDAYS;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek SATURDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek SUNDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek THURSDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek TUESDAY;
+ field public static final androidx.appactions.builtintypes.types.DayOfWeek WEDNESDAY;
+ }
+
+ public static final class DayOfWeek.Companion {
+ }
+
+ public static interface DayOfWeek.Mapper<R> {
+ method public default R friday();
+ method public default R monday();
+ method public R orElse();
+ method public default R publicHolidays();
+ method public default R saturday();
+ method public default R sunday();
+ method public default R thursday();
+ method public default R tuesday();
+ method public default R wednesday();
+ }
+
+ public abstract class GenericAlarm<Self extends androidx.appactions.builtintypes.types.GenericAlarm<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericAlarm.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Alarm {
+ ctor public GenericAlarm(androidx.appactions.builtintypes.types.Alarm alarm);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final androidx.appactions.builtintypes.types.Schedule? getAlarmSchedule();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final androidx.appactions.builtintypes.types.Schedule? alarmSchedule;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract static class GenericAlarm.Builder<Self extends androidx.appactions.builtintypes.types.GenericAlarm.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericAlarm<Built, Self>> implements androidx.appactions.builtintypes.types.Alarm.Builder<Self> {
+ ctor public GenericAlarm.Builder();
+ method public final Built build();
+ method protected abstract Built buildFromAlarm(androidx.appactions.builtintypes.types.Alarm alarm);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setAlarmSchedule(androidx.appactions.builtintypes.types.Schedule? schedule);
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract class GenericIntangible<Self extends androidx.appactions.builtintypes.types.GenericIntangible<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericIntangible.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Intangible {
+ ctor public GenericIntangible(androidx.appactions.builtintypes.types.Intangible intangible);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract static class GenericIntangible.Builder<Self extends androidx.appactions.builtintypes.types.GenericIntangible.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericIntangible<Built, Self>> implements androidx.appactions.builtintypes.types.Intangible.Builder<Self> {
+ ctor public GenericIntangible.Builder();
+ method public final Built build();
+ method protected abstract Built buildFromIntangible(androidx.appactions.builtintypes.types.Intangible intangible);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract class GenericSchedule<Self extends androidx.appactions.builtintypes.types.GenericSchedule<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericSchedule.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Schedule {
+ ctor public GenericSchedule(androidx.appactions.builtintypes.types.Schedule schedule);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final java.util.List<androidx.appactions.builtintypes.properties.ByDay> getByDays();
+ method public final java.util.List<java.lang.Long> getByMonthDays();
+ method public final java.util.List<java.lang.Long> getByMonthWeeks();
+ method public final java.util.List<java.lang.Long> getByMonths();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final androidx.appactions.builtintypes.properties.EndDate? getEndDate();
+ method public final androidx.appactions.builtintypes.properties.EndTime? getEndTime();
+ method public final androidx.appactions.builtintypes.properties.ExceptDate? getExceptDate();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method public final Long? getRepeatCount();
+ method public final androidx.appactions.builtintypes.properties.RepeatFrequency? getRepeatFrequency();
+ method public final String? getScheduleTimezone();
+ method protected abstract String getSelfTypeName();
+ method public final androidx.appactions.builtintypes.properties.StartDate? getStartDate();
+ method public final androidx.appactions.builtintypes.properties.StartTime? getStartTime();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final java.util.List<androidx.appactions.builtintypes.properties.ByDay> byDays;
+ property public final java.util.List<java.lang.Long> byMonthDays;
+ property public final java.util.List<java.lang.Long> byMonthWeeks;
+ property public final java.util.List<java.lang.Long> byMonths;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final androidx.appactions.builtintypes.properties.EndDate? endDate;
+ property public final androidx.appactions.builtintypes.properties.EndTime? endTime;
+ property public final androidx.appactions.builtintypes.properties.ExceptDate? exceptDate;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property public final Long? repeatCount;
+ property public final androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency;
+ property public final String? scheduleTimezone;
+ property protected abstract String selfTypeName;
+ property public final androidx.appactions.builtintypes.properties.StartDate? startDate;
+ property public final androidx.appactions.builtintypes.properties.StartTime? startTime;
+ }
+
+ public abstract static class GenericSchedule.Builder<Self extends androidx.appactions.builtintypes.types.GenericSchedule.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericSchedule<Built, Self>> implements androidx.appactions.builtintypes.types.Schedule.Builder<Self> {
+ ctor public GenericSchedule.Builder();
+ method public final Self addByDay(androidx.appactions.builtintypes.properties.ByDay byDay);
+ method public final Self addByDays(Iterable<androidx.appactions.builtintypes.properties.ByDay> values);
+ method public final Self addByMonth(long integer);
+ method public final Self addByMonthDay(long integer);
+ method public final Self addByMonthDays(Iterable<java.lang.Long> values);
+ method public final Self addByMonthWeek(long integer);
+ method public final Self addByMonthWeeks(Iterable<java.lang.Long> values);
+ method public final Self addByMonths(Iterable<java.lang.Long> values);
+ method public final Built build();
+ method protected abstract Built buildFromSchedule(androidx.appactions.builtintypes.types.Schedule schedule);
+ method public final Self clearByDays();
+ method public final Self clearByMonthDays();
+ method public final Self clearByMonthWeeks();
+ method public final Self clearByMonths();
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setEndDate(androidx.appactions.builtintypes.properties.EndDate? endDate);
+ method public final Self setEndTime(androidx.appactions.builtintypes.properties.EndTime? endTime);
+ method public final Self setExceptDate(androidx.appactions.builtintypes.properties.ExceptDate? exceptDate);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final Self setRepeatCount(Long? integer);
+ method public final Self setRepeatFrequency(androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency);
+ method public final Self setScheduleTimezone(String? text);
+ method public final Self setStartDate(androidx.appactions.builtintypes.properties.StartDate? startDate);
+ method public final Self setStartTime(androidx.appactions.builtintypes.properties.StartTime? startTime);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
public abstract class GenericThing<Self extends androidx.appactions.builtintypes.types.GenericThing<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericThing.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Thing {
ctor public GenericThing(androidx.appactions.builtintypes.types.Thing thing);
method public final boolean equals(Object? other);
@@ -67,6 +409,135 @@
property protected abstract String selfTypeName;
}
+ public abstract class GenericTimer<Self extends androidx.appactions.builtintypes.types.GenericTimer<Self, Builder>, Builder extends androidx.appactions.builtintypes.types.GenericTimer.Builder<Builder, Self>> implements androidx.appactions.builtintypes.types.Timer {
+ ctor public GenericTimer(androidx.appactions.builtintypes.types.Timer timer);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
+ method public final java.time.Duration? getDuration();
+ method public final String? getIdentifier();
+ method public final androidx.appactions.builtintypes.properties.Name? getName();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Builder toBuilder();
+ method protected abstract Builder toBuilderWithAdditionalPropertiesOnly();
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property public final androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription;
+ property public final java.time.Duration? duration;
+ property public final String? identifier;
+ property public final androidx.appactions.builtintypes.properties.Name? name;
+ property protected abstract String selfTypeName;
+ }
+
+ public abstract static class GenericTimer.Builder<Self extends androidx.appactions.builtintypes.types.GenericTimer.Builder<Self, Built>, Built extends androidx.appactions.builtintypes.types.GenericTimer<Built, Self>> implements androidx.appactions.builtintypes.types.Timer.Builder<Self> {
+ ctor public GenericTimer.Builder();
+ method public final Built build();
+ method protected abstract Built buildFromTimer(androidx.appactions.builtintypes.types.Timer timer);
+ method public final boolean equals(Object? other);
+ method protected abstract java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties();
+ method protected abstract String getSelfTypeName();
+ method public final int hashCode();
+ method public final Self setDisambiguatingDescription(androidx.appactions.builtintypes.properties.DisambiguatingDescription? disambiguatingDescription);
+ method public final Self setDuration(java.time.Duration? duration);
+ method public final Self setIdentifier(String? text);
+ method public final Self setName(androidx.appactions.builtintypes.properties.Name? name);
+ method public final String toString();
+ property protected abstract java.util.Map<java.lang.String,java.lang.Object> additionalProperties;
+ property protected abstract String selfTypeName;
+ }
+
+ public interface Intangible extends androidx.appactions.builtintypes.types.Thing {
+ method public default static androidx.appactions.builtintypes.types.Intangible.Builder<?> Builder();
+ method public androidx.appactions.builtintypes.types.Intangible.Builder<?> toBuilder();
+ field public static final androidx.appactions.builtintypes.types.Intangible.Companion Companion;
+ }
+
+ public static interface Intangible.Builder<Self extends androidx.appactions.builtintypes.types.Intangible.Builder<Self>> extends androidx.appactions.builtintypes.types.Thing.Builder<Self> {
+ method public androidx.appactions.builtintypes.types.Intangible build();
+ }
+
+ public static final class Intangible.Companion {
+ method public androidx.appactions.builtintypes.types.Intangible.Builder<?> Builder();
+ }
+
+ public interface Schedule extends androidx.appactions.builtintypes.types.Intangible {
+ method public default static androidx.appactions.builtintypes.types.Schedule.Builder<?> Builder();
+ method public java.util.List<androidx.appactions.builtintypes.properties.ByDay> getByDays();
+ method public java.util.List<java.lang.Long> getByMonthDays();
+ method public java.util.List<java.lang.Long> getByMonthWeeks();
+ method public java.util.List<java.lang.Long> getByMonths();
+ method public androidx.appactions.builtintypes.properties.EndDate? getEndDate();
+ method public androidx.appactions.builtintypes.properties.EndTime? getEndTime();
+ method public androidx.appactions.builtintypes.properties.ExceptDate? getExceptDate();
+ method public Long? getRepeatCount();
+ method public androidx.appactions.builtintypes.properties.RepeatFrequency? getRepeatFrequency();
+ method public String? getScheduleTimezone();
+ method public androidx.appactions.builtintypes.properties.StartDate? getStartDate();
+ method public androidx.appactions.builtintypes.properties.StartTime? getStartTime();
+ method public androidx.appactions.builtintypes.types.Schedule.Builder<?> toBuilder();
+ property public abstract java.util.List<androidx.appactions.builtintypes.properties.ByDay> byDays;
+ property public abstract java.util.List<java.lang.Long> byMonthDays;
+ property public abstract java.util.List<java.lang.Long> byMonthWeeks;
+ property public abstract java.util.List<java.lang.Long> byMonths;
+ property public abstract androidx.appactions.builtintypes.properties.EndDate? endDate;
+ property public abstract androidx.appactions.builtintypes.properties.EndTime? endTime;
+ property public abstract androidx.appactions.builtintypes.properties.ExceptDate? exceptDate;
+ property public abstract Long? repeatCount;
+ property public abstract androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency;
+ property public abstract String? scheduleTimezone;
+ property public abstract androidx.appactions.builtintypes.properties.StartDate? startDate;
+ property public abstract androidx.appactions.builtintypes.properties.StartTime? startTime;
+ field public static final androidx.appactions.builtintypes.types.Schedule.Companion Companion;
+ }
+
+ public static interface Schedule.Builder<Self extends androidx.appactions.builtintypes.types.Schedule.Builder<Self>> extends androidx.appactions.builtintypes.types.Intangible.Builder<Self> {
+ method public default Self addByDay(String text);
+ method public default Self addByDay(androidx.appactions.builtintypes.types.DayOfWeek dayOfWeek);
+ method public Self addByDay(androidx.appactions.builtintypes.properties.ByDay byDay);
+ method public Self addByDays(Iterable<androidx.appactions.builtintypes.properties.ByDay> values);
+ method public Self addByMonth(long integer);
+ method public Self addByMonthDay(long integer);
+ method public Self addByMonthDays(Iterable<java.lang.Long> values);
+ method public Self addByMonthWeek(long integer);
+ method public Self addByMonthWeeks(Iterable<java.lang.Long> values);
+ method public Self addByMonths(Iterable<java.lang.Long> values);
+ method public androidx.appactions.builtintypes.types.Schedule build();
+ method public Self clearByDays();
+ method public Self clearByMonthDays();
+ method public Self clearByMonthWeeks();
+ method public Self clearByMonths();
+ method public default Self setEndDate(java.time.LocalDate date);
+ method public default Self setEndDate(java.time.LocalDateTime localDateTime);
+ method public default Self setEndDate(java.time.ZonedDateTime zonedDateTime);
+ method public Self setEndDate(androidx.appactions.builtintypes.properties.EndDate? endDate);
+ method public default Self setEndTime(java.time.LocalTime time);
+ method public default Self setEndTime(java.time.LocalDateTime localDateTime);
+ method public default Self setEndTime(java.time.ZonedDateTime zonedDateTime);
+ method public Self setEndTime(androidx.appactions.builtintypes.properties.EndTime? endTime);
+ method public default Self setExceptDate(java.time.LocalDate date);
+ method public default Self setExceptDate(java.time.LocalDateTime localDateTime);
+ method public default Self setExceptDate(java.time.ZonedDateTime zonedDateTime);
+ method public Self setExceptDate(androidx.appactions.builtintypes.properties.ExceptDate? exceptDate);
+ method public Self setRepeatCount(Long? integer);
+ method public default Self setRepeatFrequency(java.time.Duration duration);
+ method public default Self setRepeatFrequency(String text);
+ method public Self setRepeatFrequency(androidx.appactions.builtintypes.properties.RepeatFrequency? repeatFrequency);
+ method public Self setScheduleTimezone(String? text);
+ method public default Self setStartDate(java.time.LocalDate date);
+ method public default Self setStartDate(java.time.LocalDateTime localDateTime);
+ method public default Self setStartDate(java.time.ZonedDateTime zonedDateTime);
+ method public Self setStartDate(androidx.appactions.builtintypes.properties.StartDate? startDate);
+ method public default Self setStartTime(java.time.LocalTime time);
+ method public default Self setStartTime(java.time.LocalDateTime localDateTime);
+ method public default Self setStartTime(java.time.ZonedDateTime zonedDateTime);
+ method public Self setStartTime(androidx.appactions.builtintypes.properties.StartTime? startTime);
+ }
+
+ public static final class Schedule.Companion {
+ method public androidx.appactions.builtintypes.types.Schedule.Builder<?> Builder();
+ }
+
public interface Thing {
method public default static androidx.appactions.builtintypes.types.Thing.Builder<?> Builder();
method public androidx.appactions.builtintypes.properties.DisambiguatingDescription? getDisambiguatingDescription();
@@ -92,5 +563,22 @@
method public androidx.appactions.builtintypes.types.Thing.Builder<?> Builder();
}
+ public interface Timer extends androidx.appactions.builtintypes.types.Thing {
+ method public default static androidx.appactions.builtintypes.types.Timer.Builder<?> Builder();
+ method public java.time.Duration? getDuration();
+ method public androidx.appactions.builtintypes.types.Timer.Builder<?> toBuilder();
+ property public abstract java.time.Duration? duration;
+ field public static final androidx.appactions.builtintypes.types.Timer.Companion Companion;
+ }
+
+ public static interface Timer.Builder<Self extends androidx.appactions.builtintypes.types.Timer.Builder<Self>> extends androidx.appactions.builtintypes.types.Thing.Builder<Self> {
+ method public androidx.appactions.builtintypes.types.Timer build();
+ method public Self setDuration(java.time.Duration? duration);
+ }
+
+ public static final class Timer.Companion {
+ method public androidx.appactions.builtintypes.types.Timer.Builder<?> Builder();
+ }
+
}
diff --git a/appactions/builtintypes/builtintypes-core/build.gradle b/appactions/builtintypes/builtintypes-core/build.gradle
index 828e4de..fd57aad 100644
--- a/appactions/builtintypes/builtintypes-core/build.gradle
+++ b/appactions/builtintypes/builtintypes-core/build.gradle
@@ -34,6 +34,9 @@
android {
namespace "androidx.appactions.builtintypes.core"
+ defaultConfig {
+ minSdkVersion 26
+ }
}
tasks.withType(KotlinCompile).configureEach {
diff --git a/appactions/builtintypes/builtintypes-core/samples/build.gradle b/appactions/builtintypes/builtintypes-core/samples/build.gradle
index 541472a..871e254 100644
--- a/appactions/builtintypes/builtintypes-core/samples/build.gradle
+++ b/appactions/builtintypes/builtintypes-core/samples/build.gradle
@@ -31,6 +31,9 @@
android {
namespace "androidx.appactions.builtintypes.core.samples"
+ defaultConfig {
+ minSdkVersion 26
+ }
}
androidx {
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/ByDaySamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/ByDaySamples.kt
new file mode 100644
index 0000000..3c5a4de
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/ByDaySamples.kt
@@ -0,0 +1,32 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.ByDay
+import androidx.appactions.builtintypes.types.DayOfWeek
+import kotlin.String
+
+@Sampled
+public fun byDayMapWhenUsage(byDay: ByDay) =
+ byDay.mapWhen(
+ object : ByDay.Mapper<String> {
+ public override fun text(instance: String): String = """Got String: $instance"""
+
+ public override fun dayOfWeek(instance: DayOfWeek): String =
+ """Got enum DayOfWeek: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $byDay"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/EndDateSamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/EndDateSamples.kt
new file mode 100644
index 0000000..51f745e
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/EndDateSamples.kt
@@ -0,0 +1,37 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.EndDate
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import kotlin.String
+
+@Sampled
+public fun endDateMapWhenUsage(endDate: EndDate) =
+ endDate.mapWhen(
+ object : EndDate.Mapper<String> {
+ public override fun date(instance: LocalDate): String = """Got LocalDate: $instance"""
+
+ public override fun localDateTime(instance: LocalDateTime): String =
+ """Got a local DateTime: $instance"""
+
+ public override fun zonedDateTime(instance: ZonedDateTime): String =
+ """Got a zoned/absolute DateTime: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $endDate"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/EndTimeSamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/EndTimeSamples.kt
new file mode 100644
index 0000000..6094ef9
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/EndTimeSamples.kt
@@ -0,0 +1,37 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.EndTime
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.ZonedDateTime
+import kotlin.String
+
+@Sampled
+public fun endTimeMapWhenUsage(endTime: EndTime) =
+ endTime.mapWhen(
+ object : EndTime.Mapper<String> {
+ public override fun time(instance: LocalTime): String = """Got LocalTime: $instance"""
+
+ public override fun localDateTime(instance: LocalDateTime): String =
+ """Got a local DateTime: $instance"""
+
+ public override fun zonedDateTime(instance: ZonedDateTime): String =
+ """Got a zoned/absolute DateTime: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $endTime"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/ExceptDateSamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/ExceptDateSamples.kt
new file mode 100644
index 0000000..980a3df
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/ExceptDateSamples.kt
@@ -0,0 +1,37 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.ExceptDate
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import kotlin.String
+
+@Sampled
+public fun exceptDateMapWhenUsage(exceptDate: ExceptDate) =
+ exceptDate.mapWhen(
+ object : ExceptDate.Mapper<String> {
+ public override fun date(instance: LocalDate): String = """Got LocalDate: $instance"""
+
+ public override fun localDateTime(instance: LocalDateTime): String =
+ """Got a local DateTime: $instance"""
+
+ public override fun zonedDateTime(instance: ZonedDateTime): String =
+ """Got a zoned/absolute DateTime: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $exceptDate"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/RepeatFrequencySamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/RepeatFrequencySamples.kt
new file mode 100644
index 0000000..b01216f
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/RepeatFrequencySamples.kt
@@ -0,0 +1,31 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.RepeatFrequency
+import java.time.Duration
+import kotlin.String
+
+@Sampled
+public fun repeatFrequencyMapWhenUsage(repeatFrequency: RepeatFrequency) =
+ repeatFrequency.mapWhen(
+ object : RepeatFrequency.Mapper<String> {
+ public override fun duration(instance: Duration): String = """Got Duration: $instance"""
+
+ public override fun text(instance: String): String = """Got String: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $repeatFrequency"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/StartDateSamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/StartDateSamples.kt
new file mode 100644
index 0000000..60772b6
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/StartDateSamples.kt
@@ -0,0 +1,37 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.StartDate
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import kotlin.String
+
+@Sampled
+public fun startDateMapWhenUsage(startDate: StartDate) =
+ startDate.mapWhen(
+ object : StartDate.Mapper<String> {
+ public override fun date(instance: LocalDate): String = """Got LocalDate: $instance"""
+
+ public override fun localDateTime(instance: LocalDateTime): String =
+ """Got a local DateTime: $instance"""
+
+ public override fun zonedDateTime(instance: ZonedDateTime): String =
+ """Got a zoned/absolute DateTime: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $startDate"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/StartTimeSamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/StartTimeSamples.kt
new file mode 100644
index 0000000..b110553
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/properties/StartTimeSamples.kt
@@ -0,0 +1,37 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.properties
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.properties.StartTime
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.ZonedDateTime
+import kotlin.String
+
+@Sampled
+public fun startTimeMapWhenUsage(startTime: StartTime) =
+ startTime.mapWhen(
+ object : StartTime.Mapper<String> {
+ public override fun time(instance: LocalTime): String = """Got LocalTime: $instance"""
+
+ public override fun localDateTime(instance: LocalDateTime): String =
+ """Got a local DateTime: $instance"""
+
+ public override fun zonedDateTime(instance: ZonedDateTime): String =
+ """Got a zoned/absolute DateTime: $instance"""
+
+ public override fun orElse(): String = """Got some unrecognized variant: $startTime"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/types/DayOfWeekSamples.kt b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/types/DayOfWeekSamples.kt
new file mode 100644
index 0000000..633f7d4
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/samples/src/main/java/androidx/appactions/builtintypes/samples/types/DayOfWeekSamples.kt
@@ -0,0 +1,42 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.samples.types
+
+import androidx.`annotation`.Sampled
+import androidx.appactions.builtintypes.types.DayOfWeek
+import kotlin.String
+
+@Sampled
+public fun dayOfWeekMapWhenUsage(dayOfWeek: DayOfWeek) =
+ dayOfWeek.mapWhen(
+ object : DayOfWeek.Mapper<String> {
+ public override fun friday(): String = "Got Friday"
+
+ public override fun monday(): String = "Got Monday"
+
+ public override fun publicHolidays(): String = "Got PublicHolidays"
+
+ public override fun saturday(): String = "Got Saturday"
+
+ public override fun sunday(): String = "Got Sunday"
+
+ public override fun thursday(): String = "Got Thursday"
+
+ public override fun tuesday(): String = "Got Tuesday"
+
+ public override fun wednesday(): String = "Got Wednesday"
+
+ public override fun orElse(): String = """Got some unrecognized DayOfWeek: $dayOfWeek"""
+ }
+ )
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/ByDay.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/ByDay.kt
new file mode 100644
index 0000000..08b3cfa
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/ByDay.kt
@@ -0,0 +1,111 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import androidx.appactions.builtintypes.types.DayOfWeek
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * Defines the day(s) of the week on which a recurring Event takes place.
+ *
+ * See http://schema.org/byDay for context.
+ *
+ * Holds one of:
+ * * Text i.e. [String]
+ * * [DayOfWeek]
+ *
+ * May hold more types over time.
+ */
+public class ByDay
+internal constructor(
+ /** The [String] variant, or null if constructed using a different variant. */
+ @get:JvmName("asText") public val asText: String? = null,
+ /** The [DayOfWeek] variant, or null if constructed using a different variant. */
+ @get:JvmName("asDayOfWeek") public val asDayOfWeek: DayOfWeek? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [String] variant. */
+ public constructor(text: String) : this(asText = text)
+
+ /** Constructor for the [DayOfWeek] variant. */
+ public constructor(dayOfWeek: DayOfWeek) : this(asDayOfWeek = dayOfWeek)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.byDayMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asText != null -> mapper.text(asText)
+ asDayOfWeek != null -> mapper.dayOfWeek(asDayOfWeek)
+ else -> error("No variant present in ByDay")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asText != null ->
+ if (includeWrapperName) {
+ """ByDay($asText)"""
+ } else {
+ asText
+ }
+ asDayOfWeek != null ->
+ if (includeWrapperName) {
+ """ByDay($asDayOfWeek)"""
+ } else {
+ asDayOfWeek.toString()
+ }
+ else -> error("No variant present in ByDay")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is ByDay) return false
+ if (asText != other.asText) return false
+ if (asDayOfWeek != other.asDayOfWeek) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asText, asDayOfWeek)
+
+ /** Maps each of the possible variants of [ByDay] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [ByDay] holds some [String] instance. */
+ public fun text(instance: String): R = orElse()
+
+ /** Returns some [R] when the [ByDay] holds some [DayOfWeek] instance. */
+ public fun dayOfWeek(instance: DayOfWeek): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/EndDate.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/EndDate.kt
new file mode 100644
index 0000000..785b1e6
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/EndDate.kt
@@ -0,0 +1,130 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * The end date and time of the item.
+ *
+ * See http://schema.org/endDate for context.
+ *
+ * Holds one of:
+ * * Date i.e. [LocalDate]
+ * * [LocalDateTime]
+ * * [ZonedDateTime]
+ *
+ * May hold more types over time.
+ */
+public class EndDate
+internal constructor(
+ /** The [LocalDate] variant, or null if constructed using a different variant. */
+ @get:JvmName("asDate") public val asDate: LocalDate? = null,
+ /** The [LocalDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asLocalDateTime") public val asLocalDateTime: LocalDateTime? = null,
+ /** The [ZonedDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asZonedDateTime") public val asZonedDateTime: ZonedDateTime? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [LocalDate] variant. */
+ public constructor(date: LocalDate) : this(asDate = date)
+
+ /** Constructor for the [LocalDateTime] variant. */
+ public constructor(localDateTime: LocalDateTime) : this(asLocalDateTime = localDateTime)
+
+ /** Constructor for the [ZonedDateTime] variant. */
+ public constructor(zonedDateTime: ZonedDateTime) : this(asZonedDateTime = zonedDateTime)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.endDateMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asDate != null -> mapper.date(asDate)
+ asLocalDateTime != null -> mapper.localDateTime(asLocalDateTime)
+ asZonedDateTime != null -> mapper.zonedDateTime(asZonedDateTime)
+ else -> error("No variant present in EndDate")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asDate != null ->
+ if (includeWrapperName) {
+ """EndDate($asDate)"""
+ } else {
+ asDate.toString()
+ }
+ asLocalDateTime != null ->
+ if (includeWrapperName) {
+ """EndDate($asLocalDateTime)"""
+ } else {
+ asLocalDateTime.toString()
+ }
+ asZonedDateTime != null ->
+ if (includeWrapperName) {
+ """EndDate($asZonedDateTime)"""
+ } else {
+ asZonedDateTime.toString()
+ }
+ else -> error("No variant present in EndDate")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is EndDate) return false
+ if (asDate != other.asDate) return false
+ if (asLocalDateTime != other.asLocalDateTime) return false
+ if (asZonedDateTime != other.asZonedDateTime) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asDate, asLocalDateTime, asZonedDateTime)
+
+ /** Maps each of the possible variants of [EndDate] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [EndDate] holds some [LocalDate] instance. */
+ public fun date(instance: LocalDate): R = orElse()
+
+ /** Returns some [R] when the [EndDate] holds some [LocalDateTime] instance. */
+ public fun localDateTime(instance: LocalDateTime): R = orElse()
+
+ /** Returns some [R] when the [EndDate] holds some [ZonedDateTime] instance. */
+ public fun zonedDateTime(instance: ZonedDateTime): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/EndTime.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/EndTime.kt
new file mode 100644
index 0000000..a2b3b28
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/EndTime.kt
@@ -0,0 +1,135 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.ZonedDateTime
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * The endTime of something.
+ *
+ * For a reserved event or service (e.g. `FoodEstablishmentReservation`), the time that it is
+ * expected to end. For actions that span a period of time, when the action was performed. E.g. John
+ * wrote a book from January to *December*. For media, including audio and video, it's the time
+ * offset of the end of a clip within a larger file.
+ *
+ * See http://schema.org/endTime for context.
+ *
+ * Holds one of:
+ * * Time i.e. [LocalTime]
+ * * [LocalDateTime]
+ * * [ZonedDateTime]
+ *
+ * May hold more types over time.
+ */
+public class EndTime
+internal constructor(
+ /** The [LocalTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asTime") public val asTime: LocalTime? = null,
+ /** The [LocalDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asLocalDateTime") public val asLocalDateTime: LocalDateTime? = null,
+ /** The [ZonedDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asZonedDateTime") public val asZonedDateTime: ZonedDateTime? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [LocalTime] variant. */
+ public constructor(time: LocalTime) : this(asTime = time)
+
+ /** Constructor for the [LocalDateTime] variant. */
+ public constructor(localDateTime: LocalDateTime) : this(asLocalDateTime = localDateTime)
+
+ /** Constructor for the [ZonedDateTime] variant. */
+ public constructor(zonedDateTime: ZonedDateTime) : this(asZonedDateTime = zonedDateTime)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.endTimeMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asTime != null -> mapper.time(asTime)
+ asLocalDateTime != null -> mapper.localDateTime(asLocalDateTime)
+ asZonedDateTime != null -> mapper.zonedDateTime(asZonedDateTime)
+ else -> error("No variant present in EndTime")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asTime != null ->
+ if (includeWrapperName) {
+ """EndTime($asTime)"""
+ } else {
+ asTime.toString()
+ }
+ asLocalDateTime != null ->
+ if (includeWrapperName) {
+ """EndTime($asLocalDateTime)"""
+ } else {
+ asLocalDateTime.toString()
+ }
+ asZonedDateTime != null ->
+ if (includeWrapperName) {
+ """EndTime($asZonedDateTime)"""
+ } else {
+ asZonedDateTime.toString()
+ }
+ else -> error("No variant present in EndTime")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is EndTime) return false
+ if (asTime != other.asTime) return false
+ if (asLocalDateTime != other.asLocalDateTime) return false
+ if (asZonedDateTime != other.asZonedDateTime) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asTime, asLocalDateTime, asZonedDateTime)
+
+ /** Maps each of the possible variants of [EndTime] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [EndTime] holds some [LocalTime] instance. */
+ public fun time(instance: LocalTime): R = orElse()
+
+ /** Returns some [R] when the [EndTime] holds some [LocalDateTime] instance. */
+ public fun localDateTime(instance: LocalDateTime): R = orElse()
+
+ /** Returns some [R] when the [EndTime] holds some [ZonedDateTime] instance. */
+ public fun zonedDateTime(instance: ZonedDateTime): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/ExceptDate.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/ExceptDate.kt
new file mode 100644
index 0000000..ae356b4
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/ExceptDate.kt
@@ -0,0 +1,135 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * Defines a `Date` or `DateTime` during which a scheduled `Event` will not take place. The property
+ * allows exceptions to a `Schedule` to be specified. If an exception is specified as a `DateTime`
+ * then only the event that would have started at that specific date and time should be excluded
+ * from the schedule. If an exception is specified as a `Date` then any event that is scheduled for
+ * that 24 hour period should be excluded from the schedule. This allows a whole day to be excluded
+ * from the schedule without having to itemise every scheduled event.
+ *
+ * See http://schema.org/exceptDate for context.
+ *
+ * Holds one of:
+ * * Date i.e. [LocalDate]
+ * * [LocalDateTime]
+ * * [ZonedDateTime]
+ *
+ * May hold more types over time.
+ */
+public class ExceptDate
+internal constructor(
+ /** The [LocalDate] variant, or null if constructed using a different variant. */
+ @get:JvmName("asDate") public val asDate: LocalDate? = null,
+ /** The [LocalDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asLocalDateTime") public val asLocalDateTime: LocalDateTime? = null,
+ /** The [ZonedDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asZonedDateTime") public val asZonedDateTime: ZonedDateTime? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [LocalDate] variant. */
+ public constructor(date: LocalDate) : this(asDate = date)
+
+ /** Constructor for the [LocalDateTime] variant. */
+ public constructor(localDateTime: LocalDateTime) : this(asLocalDateTime = localDateTime)
+
+ /** Constructor for the [ZonedDateTime] variant. */
+ public constructor(zonedDateTime: ZonedDateTime) : this(asZonedDateTime = zonedDateTime)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.exceptDateMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asDate != null -> mapper.date(asDate)
+ asLocalDateTime != null -> mapper.localDateTime(asLocalDateTime)
+ asZonedDateTime != null -> mapper.zonedDateTime(asZonedDateTime)
+ else -> error("No variant present in ExceptDate")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asDate != null ->
+ if (includeWrapperName) {
+ """ExceptDate($asDate)"""
+ } else {
+ asDate.toString()
+ }
+ asLocalDateTime != null ->
+ if (includeWrapperName) {
+ """ExceptDate($asLocalDateTime)"""
+ } else {
+ asLocalDateTime.toString()
+ }
+ asZonedDateTime != null ->
+ if (includeWrapperName) {
+ """ExceptDate($asZonedDateTime)"""
+ } else {
+ asZonedDateTime.toString()
+ }
+ else -> error("No variant present in ExceptDate")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is ExceptDate) return false
+ if (asDate != other.asDate) return false
+ if (asLocalDateTime != other.asLocalDateTime) return false
+ if (asZonedDateTime != other.asZonedDateTime) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asDate, asLocalDateTime, asZonedDateTime)
+
+ /** Maps each of the possible variants of [ExceptDate] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [ExceptDate] holds some [LocalDate] instance. */
+ public fun date(instance: LocalDate): R = orElse()
+
+ /** Returns some [R] when the [ExceptDate] holds some [LocalDateTime] instance. */
+ public fun localDateTime(instance: LocalDateTime): R = orElse()
+
+ /** Returns some [R] when the [ExceptDate] holds some [ZonedDateTime] instance. */
+ public fun zonedDateTime(instance: ZonedDateTime): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/RepeatFrequency.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/RepeatFrequency.kt
new file mode 100644
index 0000000..e04c423
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/RepeatFrequency.kt
@@ -0,0 +1,112 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import java.time.Duration
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * Defines the frequency at which `Event`s will occur according to a schedule `Schedule`. The
+ * intervals between events should be defined as a `Duration` of time.
+ *
+ * See http://schema.org/repeatFrequency for context.
+ *
+ * Holds one of:
+ * * [Duration]
+ * * Text i.e. [String]
+ *
+ * May hold more types over time.
+ */
+public class RepeatFrequency
+internal constructor(
+ /** The [Duration] variant, or null if constructed using a different variant. */
+ @get:JvmName("asDuration") public val asDuration: Duration? = null,
+ /** The [String] variant, or null if constructed using a different variant. */
+ @get:JvmName("asText") public val asText: String? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [Duration] variant. */
+ public constructor(duration: Duration) : this(asDuration = duration)
+
+ /** Constructor for the [String] variant. */
+ public constructor(text: String) : this(asText = text)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.repeatFrequencyMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asDuration != null -> mapper.duration(asDuration)
+ asText != null -> mapper.text(asText)
+ else -> error("No variant present in RepeatFrequency")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asDuration != null ->
+ if (includeWrapperName) {
+ """RepeatFrequency($asDuration)"""
+ } else {
+ asDuration.toString()
+ }
+ asText != null ->
+ if (includeWrapperName) {
+ """RepeatFrequency($asText)"""
+ } else {
+ asText
+ }
+ else -> error("No variant present in RepeatFrequency")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is RepeatFrequency) return false
+ if (asDuration != other.asDuration) return false
+ if (asText != other.asText) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asDuration, asText)
+
+ /** Maps each of the possible variants of [RepeatFrequency] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [RepeatFrequency] holds some [Duration] instance. */
+ public fun duration(instance: Duration): R = orElse()
+
+ /** Returns some [R] when the [RepeatFrequency] holds some [String] instance. */
+ public fun text(instance: String): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/StartDate.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/StartDate.kt
new file mode 100644
index 0000000..756b162e
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/StartDate.kt
@@ -0,0 +1,130 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * The start date and time of the item.
+ *
+ * See http://schema.org/startDate for context.
+ *
+ * Holds one of:
+ * * Date i.e. [LocalDate]
+ * * [LocalDateTime]
+ * * [ZonedDateTime]
+ *
+ * May hold more types over time.
+ */
+public class StartDate
+internal constructor(
+ /** The [LocalDate] variant, or null if constructed using a different variant. */
+ @get:JvmName("asDate") public val asDate: LocalDate? = null,
+ /** The [LocalDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asLocalDateTime") public val asLocalDateTime: LocalDateTime? = null,
+ /** The [ZonedDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asZonedDateTime") public val asZonedDateTime: ZonedDateTime? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [LocalDate] variant. */
+ public constructor(date: LocalDate) : this(asDate = date)
+
+ /** Constructor for the [LocalDateTime] variant. */
+ public constructor(localDateTime: LocalDateTime) : this(asLocalDateTime = localDateTime)
+
+ /** Constructor for the [ZonedDateTime] variant. */
+ public constructor(zonedDateTime: ZonedDateTime) : this(asZonedDateTime = zonedDateTime)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.startDateMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asDate != null -> mapper.date(asDate)
+ asLocalDateTime != null -> mapper.localDateTime(asLocalDateTime)
+ asZonedDateTime != null -> mapper.zonedDateTime(asZonedDateTime)
+ else -> error("No variant present in StartDate")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asDate != null ->
+ if (includeWrapperName) {
+ """StartDate($asDate)"""
+ } else {
+ asDate.toString()
+ }
+ asLocalDateTime != null ->
+ if (includeWrapperName) {
+ """StartDate($asLocalDateTime)"""
+ } else {
+ asLocalDateTime.toString()
+ }
+ asZonedDateTime != null ->
+ if (includeWrapperName) {
+ """StartDate($asZonedDateTime)"""
+ } else {
+ asZonedDateTime.toString()
+ }
+ else -> error("No variant present in StartDate")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is StartDate) return false
+ if (asDate != other.asDate) return false
+ if (asLocalDateTime != other.asLocalDateTime) return false
+ if (asZonedDateTime != other.asZonedDateTime) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asDate, asLocalDateTime, asZonedDateTime)
+
+ /** Maps each of the possible variants of [StartDate] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [StartDate] holds some [LocalDate] instance. */
+ public fun date(instance: LocalDate): R = orElse()
+
+ /** Returns some [R] when the [StartDate] holds some [LocalDateTime] instance. */
+ public fun localDateTime(instance: LocalDateTime): R = orElse()
+
+ /** Returns some [R] when the [StartDate] holds some [ZonedDateTime] instance. */
+ public fun zonedDateTime(instance: ZonedDateTime): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/StartTime.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/StartTime.kt
new file mode 100644
index 0000000..8105722
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/properties/StartTime.kt
@@ -0,0 +1,135 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.properties
+
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.ZonedDateTime
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.error
+import kotlin.jvm.JvmName
+
+/**
+ * The startTime of something.
+ *
+ * For a reserved event or service (e.g. `FoodEstablishmentReservation`), the time that it is
+ * expected to start. For actions that span a period of time, when the action was performed. E.g.
+ * John wrote a book from *January* to December. For media, including audio and video, it's the time
+ * offset of the start of a clip within a larger file.
+ *
+ * See http://schema.org/startTime for context.
+ *
+ * Holds one of:
+ * * Time i.e. [LocalTime]
+ * * [LocalDateTime]
+ * * [ZonedDateTime]
+ *
+ * May hold more types over time.
+ */
+public class StartTime
+internal constructor(
+ /** The [LocalTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asTime") public val asTime: LocalTime? = null,
+ /** The [LocalDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asLocalDateTime") public val asLocalDateTime: LocalDateTime? = null,
+ /** The [ZonedDateTime] variant, or null if constructed using a different variant. */
+ @get:JvmName("asZonedDateTime") public val asZonedDateTime: ZonedDateTime? = null,
+ /**
+ * The AppSearch document's identifier.
+ *
+ * Every AppSearch document needs an identifier. Since property wrappers are only meant to be used
+ * at nested levels, this is internal and will always be an empty string.
+ */
+ internal val identifier: String = "",
+) {
+ /** Constructor for the [LocalTime] variant. */
+ public constructor(time: LocalTime) : this(asTime = time)
+
+ /** Constructor for the [LocalDateTime] variant. */
+ public constructor(localDateTime: LocalDateTime) : this(asLocalDateTime = localDateTime)
+
+ /** Constructor for the [ZonedDateTime] variant. */
+ public constructor(zonedDateTime: ZonedDateTime) : this(asZonedDateTime = zonedDateTime)
+
+ /**
+ * Maps each of the possible underlying variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new type is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.properties.startTimeMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when {
+ asTime != null -> mapper.time(asTime)
+ asLocalDateTime != null -> mapper.localDateTime(asLocalDateTime)
+ asZonedDateTime != null -> mapper.zonedDateTime(asZonedDateTime)
+ else -> error("No variant present in StartTime")
+ }
+
+ public override fun toString(): String = toString(includeWrapperName = true)
+
+ internal fun toString(includeWrapperName: Boolean): String =
+ when {
+ asTime != null ->
+ if (includeWrapperName) {
+ """StartTime($asTime)"""
+ } else {
+ asTime.toString()
+ }
+ asLocalDateTime != null ->
+ if (includeWrapperName) {
+ """StartTime($asLocalDateTime)"""
+ } else {
+ asLocalDateTime.toString()
+ }
+ asZonedDateTime != null ->
+ if (includeWrapperName) {
+ """StartTime($asZonedDateTime)"""
+ } else {
+ asZonedDateTime.toString()
+ }
+ else -> error("No variant present in StartTime")
+ }
+
+ public override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is StartTime) return false
+ if (asTime != other.asTime) return false
+ if (asLocalDateTime != other.asLocalDateTime) return false
+ if (asZonedDateTime != other.asZonedDateTime) return false
+ return true
+ }
+
+ public override fun hashCode(): Int = Objects.hash(asTime, asLocalDateTime, asZonedDateTime)
+
+ /** Maps each of the possible variants of [StartTime] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [StartTime] holds some [LocalTime] instance. */
+ public fun time(instance: LocalTime): R = orElse()
+
+ /** Returns some [R] when the [StartTime] holds some [LocalDateTime] instance. */
+ public fun localDateTime(instance: LocalDateTime): R = orElse()
+
+ /** Returns some [R] when the [StartTime] holds some [ZonedDateTime] instance. */
+ public fun zonedDateTime(instance: ZonedDateTime): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Alarm.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Alarm.kt
new file mode 100644
index 0000000..fff77c1
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Alarm.kt
@@ -0,0 +1,380 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.types
+
+import androidx.appactions.builtintypes.properties.DisambiguatingDescription
+import androidx.appactions.builtintypes.properties.Name
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.Suppress
+import kotlin.collections.Map
+import kotlin.collections.emptyMap
+import kotlin.collections.joinToString
+import kotlin.collections.map
+import kotlin.collections.mutableMapOf
+import kotlin.collections.plusAssign
+import kotlin.jvm.JvmField
+import kotlin.jvm.JvmStatic
+
+/**
+ * An alarm set to go off at a specified schedule.
+ *
+ * See http://schema.googleapis.com/Alarm for context.
+ *
+ * Should not be directly implemented. More properties may be added over time. Instead consider
+ * using [Companion.Builder] or see [GenericAlarm] if you need to extend this type.
+ */
+public interface Alarm : Thing {
+ /** Associates an Alarm with a Schedule. */
+ public val alarmSchedule: Schedule?
+
+ /** Converts this [Alarm] to its builder with all the properties copied over. */
+ public override fun toBuilder(): Builder<*>
+
+ public companion object {
+ /** Returns a default implementation of [Builder] with no properties set. */
+ @JvmStatic public fun Builder(): Builder<*> = AlarmImpl.Builder()
+ }
+
+ /**
+ * Builder for [Alarm].
+ *
+ * Should not be directly implemented. More methods may be added over time. See
+ * [GenericAlarm.Builder] if you need to extend this builder.
+ */
+ public interface Builder<Self : Builder<Self>> : Thing.Builder<Self> {
+ /** Returns a built [Alarm]. */
+ public override fun build(): Alarm
+
+ /** Sets the `alarmSchedule`. */
+ public fun setAlarmSchedule(schedule: Schedule?): Self
+
+ /** Sets the `disambiguatingDescription` to a canonical [DisambiguatingDescriptionValue]. */
+ public fun setDisambiguatingDescription(canonicalValue: DisambiguatingDescriptionValue): Self =
+ setDisambiguatingDescription(DisambiguatingDescription(canonicalValue))
+ }
+
+ /**
+ * A canonical value that may be assigned to [DisambiguatingDescription] properties in the context
+ * of [Alarm].
+ *
+ * Represents an open enum. See [Companion] for the different possible variants. More variants may
+ * be added over time.
+ */
+ public class DisambiguatingDescriptionValue
+ private constructor(
+ public override val textValue: String,
+ ) : DisambiguatingDescription.CanonicalValue() {
+ public override fun toString(): String = """Alarm.DisambiguatingDescriptionValue($textValue)"""
+
+ public companion object {
+ @JvmField
+ public val FAMILY_BELL: DisambiguatingDescriptionValue =
+ DisambiguatingDescriptionValue("FamilyBell")
+ }
+ }
+}
+
+/**
+ * A generic implementation of [Alarm].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MyAlarm internal constructor(
+ * alarm: Alarm,
+ * val foo: String,
+ * val bars: List<Int>,
+ * ) : GenericAlarm<
+ * MyAlarm,
+ * MyAlarm.Builder
+ * >(alarm) {
+ *
+ * override val selfTypeName =
+ * "MyAlarm"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun toBuilderWithAdditionalPropertiesOnly(): Builder {
+ * return Builder()
+ * .setFoo(foo)
+ * .addBars(bars)
+ * }
+ *
+ * class Builder :
+ * GenericAlarm.Builder<
+ * Builder,
+ * MyAlarm> {...}
+ * }
+ * ```
+ *
+ * Also see [GenericAlarm.Builder].
+ */
+@Suppress("UNCHECKED_CAST")
+public abstract class GenericAlarm<
+ Self : GenericAlarm<Self, Builder>, Builder : GenericAlarm.Builder<Builder, Self>>
+internal constructor(
+ public final override val alarmSchedule: Schedule?,
+ public final override val disambiguatingDescription: DisambiguatingDescription?,
+ public final override val identifier: String?,
+ public final override val name: Name?,
+) : Alarm {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ protected abstract val additionalProperties: Map<String, Any?>
+
+ /** A copy-constructor that copies over properties from another [Alarm] instance. */
+ public constructor(
+ alarm: Alarm
+ ) : this(alarm.alarmSchedule, alarm.disambiguatingDescription, alarm.identifier, alarm.name)
+
+ /** Returns a concrete [Builder] with the additional, non-[Alarm] properties copied over. */
+ protected abstract fun toBuilderWithAdditionalPropertiesOnly(): Builder
+
+ public final override fun toBuilder(): Builder =
+ toBuilderWithAdditionalPropertiesOnly()
+ .setAlarmSchedule(alarmSchedule)
+ .setDisambiguatingDescription(disambiguatingDescription)
+ .setIdentifier(identifier)
+ .setName(name)
+
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (alarmSchedule != other.alarmSchedule) return false
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ public final override fun hashCode(): Int =
+ Objects.hash(alarmSchedule, disambiguatingDescription, identifier, name, additionalProperties)
+
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (alarmSchedule != null) {
+ attributes["alarmSchedule"] = alarmSchedule.toString()
+ }
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier
+ }
+ if (name != null) {
+ attributes["name"] = name.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated = attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+
+ /**
+ * A generic implementation of [Alarm.Builder].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MyAlarm :
+ * : GenericAlarm<
+ * MyAlarm,
+ * MyAlarm.Builder>(...) {
+ *
+ * class Builder
+ * : Builder<
+ * Builder,
+ * MyAlarm
+ * >() {
+ * private var foo: String? = null
+ * private val bars = mutableListOf<Int>()
+ *
+ * override val selfTypeName =
+ * "MyAlarm.Builder"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun buildFromAlarm(
+ * alarm: Alarm
+ * ): MyAlarm {
+ * return MyAlarm(
+ * alarm,
+ * foo,
+ * bars.toList()
+ * )
+ * }
+ *
+ * fun setFoo(string: String): Builder {
+ * return apply { foo = string }
+ * }
+ *
+ * fun addBar(int: Int): Builder {
+ * return apply { bars += int }
+ * }
+ *
+ * fun addBars(values: Iterable<Int>): Builder {
+ * return apply { bars += values }
+ * }
+ * }
+ * }
+ * ```
+ *
+ * Also see [GenericAlarm].
+ */
+ @Suppress("StaticFinalBuilder")
+ public abstract class Builder<Self : Builder<Self, Built>, Built : GenericAlarm<Built, Self>> :
+ Alarm.Builder<Self> {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val additionalProperties: Map<String, Any?>
+
+ private var alarmSchedule: Schedule? = null
+
+ private var disambiguatingDescription: DisambiguatingDescription? = null
+
+ private var identifier: String? = null
+
+ private var name: Name? = null
+
+ /**
+ * Builds a concrete [Built] instance, given a built [Alarm].
+ *
+ * Subclasses should override this method to build a concrete [Built] instance that holds both
+ * the [Alarm]-specific properties and the subclass specific [additionalProperties].
+ *
+ * See the sample code in the documentation of this class for more context.
+ */
+ @Suppress("BuilderSetStyle") protected abstract fun buildFromAlarm(alarm: Alarm): Built
+
+ public final override fun build(): Built =
+ buildFromAlarm(AlarmImpl(alarmSchedule, disambiguatingDescription, identifier, name))
+
+ public final override fun setAlarmSchedule(schedule: Schedule?): Self {
+ this.alarmSchedule = schedule
+ return this as Self
+ }
+
+ public final override fun setDisambiguatingDescription(
+ disambiguatingDescription: DisambiguatingDescription?
+ ): Self {
+ this.disambiguatingDescription = disambiguatingDescription
+ return this as Self
+ }
+
+ public final override fun setIdentifier(text: String?): Self {
+ this.identifier = text
+ return this as Self
+ }
+
+ public final override fun setName(name: Name?): Self {
+ this.name = name
+ return this as Self
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (alarmSchedule != other.alarmSchedule) return false
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun hashCode(): Int =
+ Objects.hash(alarmSchedule, disambiguatingDescription, identifier, name, additionalProperties)
+
+ @Suppress("BuilderSetStyle")
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (alarmSchedule != null) {
+ attributes["alarmSchedule"] = alarmSchedule!!.toString()
+ }
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription!!.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier!!
+ }
+ if (name != null) {
+ attributes["name"] = name!!.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated =
+ attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+ }
+}
+
+internal class AlarmImpl : GenericAlarm<AlarmImpl, AlarmImpl.Builder> {
+ protected override val selfTypeName: String
+ get() = "Alarm"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ public constructor(
+ alarmSchedule: Schedule?,
+ disambiguatingDescription: DisambiguatingDescription?,
+ identifier: String?,
+ name: Name?,
+ ) : super(alarmSchedule, disambiguatingDescription, identifier, name)
+
+ public constructor(alarm: Alarm) : super(alarm)
+
+ protected override fun toBuilderWithAdditionalPropertiesOnly(): Builder = Builder()
+
+ internal class Builder : GenericAlarm.Builder<Builder, AlarmImpl>() {
+ protected override val selfTypeName: String
+ get() = "Alarm.Builder"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ protected override fun buildFromAlarm(alarm: Alarm): AlarmImpl =
+ alarm as? AlarmImpl ?: AlarmImpl(alarm)
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/DayOfWeek.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/DayOfWeek.kt
new file mode 100644
index 0000000..737ebe2
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/DayOfWeek.kt
@@ -0,0 +1,120 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.types
+
+import kotlin.String
+import kotlin.jvm.JvmField
+
+/**
+ * The day of the week.
+ *
+ * See http://schema.org/DayOfWeek for context.
+ *
+ * Represents an open enum. See [Companion] for the different possible variants. More variants may
+ * be added over time.
+ */
+public class DayOfWeek
+private constructor(
+ public val canonicalUrl: String,
+) {
+ /**
+ * Maps each of the possible variants to some [R].
+ *
+ * A visitor can be provided to handle the possible variants. A catch-all default case must be
+ * provided in case a new variant is added in a future release of this library.
+ *
+ * @sample [androidx.appactions.builtintypes.samples.types.dayOfWeekMapWhenUsage]
+ */
+ public fun <R> mapWhen(mapper: Mapper<R>): R =
+ when (this) {
+ FRIDAY -> mapper.friday()
+ MONDAY -> mapper.monday()
+ PUBLIC_HOLIDAYS -> mapper.publicHolidays()
+ SATURDAY -> mapper.saturday()
+ SUNDAY -> mapper.sunday()
+ THURSDAY -> mapper.thursday()
+ TUESDAY -> mapper.tuesday()
+ WEDNESDAY -> mapper.wednesday()
+ else -> mapper.orElse()
+ }
+
+ public override fun toString(): String = """DayOfWeek($canonicalUrl)"""
+
+ public companion object {
+ /** The day of the week between Thursday and Saturday. */
+ @JvmField public val FRIDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Friday")
+
+ /** The day of the week between Sunday and Tuesday. */
+ @JvmField public val MONDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Monday")
+
+ /**
+ * This stands for any day that is a public holiday; it is a placeholder for all official public
+ * holidays in some particular location. While not technically a "day of the week", it can be
+ * used with `OpeningHoursSpecification`. In the context of an opening hours specification it
+ * can be used to indicate opening hours on public holidays, overriding general opening hours
+ * for the day of the week on which a public holiday occurs.
+ */
+ @JvmField
+ public val PUBLIC_HOLIDAYS: DayOfWeek =
+ DayOfWeek(canonicalUrl = "http://schema.org/PublicHolidays")
+
+ /** The day of the week between Friday and Sunday. */
+ @JvmField
+ public val SATURDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Saturday")
+
+ /** The day of the week between Saturday and Monday. */
+ @JvmField public val SUNDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Sunday")
+
+ /** The day of the week between Wednesday and Friday. */
+ @JvmField
+ public val THURSDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Thursday")
+
+ /** The day of the week between Monday and Wednesday. */
+ @JvmField public val TUESDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Tuesday")
+
+ /** The day of the week between Tuesday and Thursday. */
+ @JvmField
+ public val WEDNESDAY: DayOfWeek = DayOfWeek(canonicalUrl = "http://schema.org/Wednesday")
+ }
+
+ /** Maps each of the possible variants of [DayOfWeek] to some [R]. */
+ public interface Mapper<R> {
+ /** Returns some [R] when the [DayOfWeek] is [FRIDAY]. */
+ public fun friday(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [MONDAY]. */
+ public fun monday(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [PUBLIC_HOLIDAYS]. */
+ public fun publicHolidays(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [SATURDAY]. */
+ public fun saturday(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [SUNDAY]. */
+ public fun sunday(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [THURSDAY]. */
+ public fun thursday(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [TUESDAY]. */
+ public fun tuesday(): R = orElse()
+
+ /** Returns some [R] when the [DayOfWeek] is [WEDNESDAY]. */
+ public fun wednesday(): R = orElse()
+
+ /** The catch-all handler that is invoked when a particular variant isn't explicitly handled. */
+ public fun orElse(): R
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Intangible.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Intangible.kt
new file mode 100644
index 0000000..e1d1386
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Intangible.kt
@@ -0,0 +1,334 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.types
+
+import androidx.appactions.builtintypes.properties.DisambiguatingDescription
+import androidx.appactions.builtintypes.properties.Name
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.Suppress
+import kotlin.collections.Map
+import kotlin.collections.emptyMap
+import kotlin.collections.joinToString
+import kotlin.collections.map
+import kotlin.collections.mutableMapOf
+import kotlin.collections.plusAssign
+import kotlin.jvm.JvmStatic
+
+/**
+ * A utility class that serves as the umbrella for a number of 'intangible' things such as
+ * quantities, structured values, etc.
+ *
+ * See http://schema.org/Intangible for context.
+ *
+ * Should not be directly implemented. More properties may be added over time. Instead consider
+ * using [Companion.Builder] or see [GenericIntangible] if you need to extend this type.
+ */
+public interface Intangible : Thing {
+ /** Converts this [Intangible] to its builder with all the properties copied over. */
+ public override fun toBuilder(): Builder<*>
+
+ public companion object {
+ /** Returns a default implementation of [Builder] with no properties set. */
+ @JvmStatic public fun Builder(): Builder<*> = IntangibleImpl.Builder()
+ }
+
+ /**
+ * Builder for [Intangible].
+ *
+ * Should not be directly implemented. More methods may be added over time. See
+ * [GenericIntangible.Builder] if you need to extend this builder.
+ */
+ public interface Builder<Self : Builder<Self>> : Thing.Builder<Self> {
+ /** Returns a built [Intangible]. */
+ public override fun build(): Intangible
+ }
+}
+
+/**
+ * A generic implementation of [Intangible].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MyIntangible internal constructor(
+ * intangible: Intangible,
+ * val foo: String,
+ * val bars: List<Int>,
+ * ) : GenericIntangible<
+ * MyIntangible,
+ * MyIntangible.Builder
+ * >(intangible) {
+ *
+ * override val selfTypeName =
+ * "MyIntangible"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun toBuilderWithAdditionalPropertiesOnly(): Builder {
+ * return Builder()
+ * .setFoo(foo)
+ * .addBars(bars)
+ * }
+ *
+ * class Builder :
+ * GenericIntangible.Builder<
+ * Builder,
+ * MyIntangible> {...}
+ * }
+ * ```
+ *
+ * Also see [GenericIntangible.Builder].
+ */
+@Suppress("UNCHECKED_CAST")
+public abstract class GenericIntangible<
+ Self : GenericIntangible<Self, Builder>, Builder : GenericIntangible.Builder<Builder, Self>>
+internal constructor(
+ public final override val disambiguatingDescription: DisambiguatingDescription?,
+ public final override val identifier: String?,
+ public final override val name: Name?,
+) : Intangible {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ protected abstract val additionalProperties: Map<String, Any?>
+
+ /** A copy-constructor that copies over properties from another [Intangible] instance. */
+ public constructor(
+ intangible: Intangible
+ ) : this(intangible.disambiguatingDescription, intangible.identifier, intangible.name)
+
+ /** Returns a concrete [Builder] with the additional, non-[Intangible] properties copied over. */
+ protected abstract fun toBuilderWithAdditionalPropertiesOnly(): Builder
+
+ public final override fun toBuilder(): Builder =
+ toBuilderWithAdditionalPropertiesOnly()
+ .setDisambiguatingDescription(disambiguatingDescription)
+ .setIdentifier(identifier)
+ .setName(name)
+
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ public final override fun hashCode(): Int =
+ Objects.hash(disambiguatingDescription, identifier, name, additionalProperties)
+
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier
+ }
+ if (name != null) {
+ attributes["name"] = name.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated = attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+
+ /**
+ * A generic implementation of [Intangible.Builder].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MyIntangible :
+ * : GenericIntangible<
+ * MyIntangible,
+ * MyIntangible.Builder>(...) {
+ *
+ * class Builder
+ * : Builder<
+ * Builder,
+ * MyIntangible
+ * >() {
+ * private var foo: String? = null
+ * private val bars = mutableListOf<Int>()
+ *
+ * override val selfTypeName =
+ * "MyIntangible.Builder"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun buildFromIntangible(
+ * intangible: Intangible
+ * ): MyIntangible {
+ * return MyIntangible(
+ * intangible,
+ * foo,
+ * bars.toList()
+ * )
+ * }
+ *
+ * fun setFoo(string: String): Builder {
+ * return apply { foo = string }
+ * }
+ *
+ * fun addBar(int: Int): Builder {
+ * return apply { bars += int }
+ * }
+ *
+ * fun addBars(values: Iterable<Int>): Builder {
+ * return apply { bars += values }
+ * }
+ * }
+ * }
+ * ```
+ *
+ * Also see [GenericIntangible].
+ */
+ @Suppress("StaticFinalBuilder")
+ public abstract class Builder<
+ Self : Builder<Self, Built>, Built : GenericIntangible<Built, Self>> :
+ Intangible.Builder<Self> {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val additionalProperties: Map<String, Any?>
+
+ private var disambiguatingDescription: DisambiguatingDescription? = null
+
+ private var identifier: String? = null
+
+ private var name: Name? = null
+
+ /**
+ * Builds a concrete [Built] instance, given a built [Intangible].
+ *
+ * Subclasses should override this method to build a concrete [Built] instance that holds both
+ * the [Intangible]-specific properties and the subclass specific [additionalProperties].
+ *
+ * See the sample code in the documentation of this class for more context.
+ */
+ @Suppress("BuilderSetStyle")
+ protected abstract fun buildFromIntangible(intangible: Intangible): Built
+
+ public final override fun build(): Built =
+ buildFromIntangible(IntangibleImpl(disambiguatingDescription, identifier, name))
+
+ public final override fun setDisambiguatingDescription(
+ disambiguatingDescription: DisambiguatingDescription?
+ ): Self {
+ this.disambiguatingDescription = disambiguatingDescription
+ return this as Self
+ }
+
+ public final override fun setIdentifier(text: String?): Self {
+ this.identifier = text
+ return this as Self
+ }
+
+ public final override fun setName(name: Name?): Self {
+ this.name = name
+ return this as Self
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun hashCode(): Int =
+ Objects.hash(disambiguatingDescription, identifier, name, additionalProperties)
+
+ @Suppress("BuilderSetStyle")
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription!!.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier!!
+ }
+ if (name != null) {
+ attributes["name"] = name!!.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated =
+ attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+ }
+}
+
+internal class IntangibleImpl : GenericIntangible<IntangibleImpl, IntangibleImpl.Builder> {
+ protected override val selfTypeName: String
+ get() = "Intangible"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ public constructor(
+ disambiguatingDescription: DisambiguatingDescription?,
+ identifier: String?,
+ name: Name?,
+ ) : super(disambiguatingDescription, identifier, name)
+
+ public constructor(intangible: Intangible) : super(intangible)
+
+ protected override fun toBuilderWithAdditionalPropertiesOnly(): Builder = Builder()
+
+ internal class Builder : GenericIntangible.Builder<Builder, IntangibleImpl>() {
+ protected override val selfTypeName: String
+ get() = "Intangible.Builder"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ protected override fun buildFromIntangible(intangible: Intangible): IntangibleImpl =
+ intangible as? IntangibleImpl ?: IntangibleImpl(intangible)
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Schedule.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Schedule.kt
new file mode 100644
index 0000000..216380d
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Schedule.kt
@@ -0,0 +1,892 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.types
+
+import androidx.appactions.builtintypes.properties.ByDay
+import androidx.appactions.builtintypes.properties.DisambiguatingDescription
+import androidx.appactions.builtintypes.properties.EndDate
+import androidx.appactions.builtintypes.properties.EndTime
+import androidx.appactions.builtintypes.properties.ExceptDate
+import androidx.appactions.builtintypes.properties.Name
+import androidx.appactions.builtintypes.properties.RepeatFrequency
+import androidx.appactions.builtintypes.properties.StartDate
+import androidx.appactions.builtintypes.properties.StartTime
+import java.time.Duration
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.ZonedDateTime
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.Long
+import kotlin.String
+import kotlin.Suppress
+import kotlin.collections.Iterable
+import kotlin.collections.List
+import kotlin.collections.Map
+import kotlin.collections.MutableList
+import kotlin.collections.emptyMap
+import kotlin.collections.isNotEmpty
+import kotlin.collections.joinToString
+import kotlin.collections.map
+import kotlin.collections.mutableListOf
+import kotlin.collections.mutableMapOf
+import kotlin.collections.plusAssign
+import kotlin.collections.toList
+import kotlin.jvm.JvmStatic
+
+/**
+ * A schedule defines a repeating time period used to describe a regularly occurring `Event`. At a
+ * minimum a schedule will specify `repeatFrequency` which describes the interval between
+ * occurrences of the event. Additional information can be provided to specify the schedule more
+ * precisely. This includes identifying the day(s) of the week or month when the recurring event
+ * will take place, in addition to its start and end time. Schedules may also have start and end
+ * dates to indicate when they are active, e.g. to define a limited calendar of events.
+ *
+ * See http://schema.org/Schedule for context.
+ *
+ * Should not be directly implemented. More properties may be added over time. Instead consider
+ * using [Companion.Builder] or see [GenericSchedule] if you need to extend this type.
+ */
+public interface Schedule : Intangible {
+ /** Defines the day(s) of the week on which a recurring Event takes place. */
+ public val byDays: List<ByDay>
+
+ /**
+ * Defines the month(s) of the year on which a recurring Event takes place. Specified as an
+ * Integer between 1-12. January is 1.
+ */
+ public val byMonths: List<Long>
+
+ /**
+ * Defines the day(s) of the month on which a recurring Event takes place. Specified as an Integer
+ * between 1-31.
+ */
+ public val byMonthDays: List<Long>
+
+ /**
+ * Defines the week(s) of the month on which a recurring Event takes place. Specified as an
+ * Integer between 1-5. For clarity, byMonthWeek is best used in conjunction with byDay to
+ * indicate concepts like the first and third Mondays of a month.
+ */
+ public val byMonthWeeks: List<Long>
+
+ /** The end date and time of the item. */
+ public val endDate: EndDate?
+
+ /**
+ * The endTime of something.
+ *
+ * For a reserved event or service (e.g. `FoodEstablishmentReservation`), the time that it is
+ * expected to end. For actions that span a period of time, when the action was performed. E.g.
+ * John wrote a book from January to *December*. For media, including audio and video, it's the
+ * time offset of the end of a clip within a larger file.
+ */
+ public val endTime: EndTime?
+
+ /**
+ * Defines a `Date` or `DateTime` during which a scheduled `Event` will not take place. The
+ * property allows exceptions to a `Schedule` to be specified. If an exception is specified as a
+ * `DateTime` then only the event that would have started at that specific date and time should be
+ * excluded from the schedule. If an exception is specified as a `Date` then any event that is
+ * scheduled for that 24 hour period should be excluded from the schedule. This allows a whole day
+ * to be excluded from the schedule without having to itemise every scheduled event.
+ */
+ public val exceptDate: ExceptDate?
+
+ /** Defines the number of times a recurring `Event` will take place. */
+ @get:Suppress("AutoBoxing") public val repeatCount: Long?
+
+ /**
+ * Defines the frequency at which `Event`s will occur according to a schedule `Schedule`. The
+ * intervals between events should be defined as a `Duration` of time.
+ */
+ public val repeatFrequency: RepeatFrequency?
+
+ /**
+ * Indicates the timezone for which the time(s) indicated in the `Schedule` are given. The value
+ * provided should be among those listed in the IANA Time Zone Database.
+ */
+ public val scheduleTimezone: String?
+
+ /** The start date and time of the item. */
+ public val startDate: StartDate?
+
+ /**
+ * The startTime of something.
+ *
+ * For a reserved event or service (e.g. `FoodEstablishmentReservation`), the time that it is
+ * expected to start. For actions that span a period of time, when the action was performed. E.g.
+ * John wrote a book from *January* to December. For media, including audio and video, it's the
+ * time offset of the start of a clip within a larger file.
+ */
+ public val startTime: StartTime?
+
+ /** Converts this [Schedule] to its builder with all the properties copied over. */
+ public override fun toBuilder(): Builder<*>
+
+ public companion object {
+ /** Returns a default implementation of [Builder] with no properties set. */
+ @JvmStatic public fun Builder(): Builder<*> = ScheduleImpl.Builder()
+ }
+
+ /**
+ * Builder for [Schedule].
+ *
+ * Should not be directly implemented. More methods may be added over time. See
+ * [GenericSchedule.Builder] if you need to extend this builder.
+ */
+ public interface Builder<Self : Builder<Self>> : Intangible.Builder<Self> {
+ /** Returns a built [Schedule]. */
+ public override fun build(): Schedule
+
+ /** Appends [String] as a value to `byDays`. */
+ public fun addByDay(text: String): Self = addByDay(ByDay(text))
+
+ /** Appends [DayOfWeek] as a value to `byDays`. */
+ public fun addByDay(dayOfWeek: DayOfWeek): Self = addByDay(ByDay(dayOfWeek))
+
+ /** Appends a value to `byDays`. */
+ public fun addByDay(byDay: ByDay): Self
+
+ /** Appends multiple values to `byDays`. */
+ public fun addByDays(values: Iterable<ByDay>): Self
+
+ /** Clears `byDays`. */
+ public fun clearByDays(): Self
+
+ /** Appends a value to `byMonths`. */
+ public fun addByMonth(integer: Long): Self
+
+ /** Appends multiple values to `byMonths`. */
+ public fun addByMonths(values: Iterable<Long>): Self
+
+ /** Clears `byMonths`. */
+ public fun clearByMonths(): Self
+
+ /** Appends a value to `byMonthDays`. */
+ public fun addByMonthDay(integer: Long): Self
+
+ /** Appends multiple values to `byMonthDays`. */
+ public fun addByMonthDays(values: Iterable<Long>): Self
+
+ /** Clears `byMonthDays`. */
+ public fun clearByMonthDays(): Self
+
+ /** Appends a value to `byMonthWeeks`. */
+ public fun addByMonthWeek(integer: Long): Self
+
+ /** Appends multiple values to `byMonthWeeks`. */
+ public fun addByMonthWeeks(values: Iterable<Long>): Self
+
+ /** Clears `byMonthWeeks`. */
+ public fun clearByMonthWeeks(): Self
+
+ /** Sets the `endDate` to [LocalDate]. */
+ public fun setEndDate(date: LocalDate): Self = setEndDate(EndDate(date))
+
+ /** Sets the `endDate` to [LocalDateTime]. */
+ public fun setEndDate(localDateTime: LocalDateTime): Self = setEndDate(EndDate(localDateTime))
+
+ /** Sets the `endDate` to [ZonedDateTime]. */
+ public fun setEndDate(zonedDateTime: ZonedDateTime): Self = setEndDate(EndDate(zonedDateTime))
+
+ /** Sets the `endDate`. */
+ public fun setEndDate(endDate: EndDate?): Self
+
+ /** Sets the `endTime` to [LocalTime]. */
+ public fun setEndTime(time: LocalTime): Self = setEndTime(EndTime(time))
+
+ /** Sets the `endTime` to [LocalDateTime]. */
+ public fun setEndTime(localDateTime: LocalDateTime): Self = setEndTime(EndTime(localDateTime))
+
+ /** Sets the `endTime` to [ZonedDateTime]. */
+ public fun setEndTime(zonedDateTime: ZonedDateTime): Self = setEndTime(EndTime(zonedDateTime))
+
+ /** Sets the `endTime`. */
+ public fun setEndTime(endTime: EndTime?): Self
+
+ /** Sets the `exceptDate` to [LocalDate]. */
+ public fun setExceptDate(date: LocalDate): Self = setExceptDate(ExceptDate(date))
+
+ /** Sets the `exceptDate` to [LocalDateTime]. */
+ public fun setExceptDate(localDateTime: LocalDateTime): Self =
+ setExceptDate(ExceptDate(localDateTime))
+
+ /** Sets the `exceptDate` to [ZonedDateTime]. */
+ public fun setExceptDate(zonedDateTime: ZonedDateTime): Self =
+ setExceptDate(ExceptDate(zonedDateTime))
+
+ /** Sets the `exceptDate`. */
+ public fun setExceptDate(exceptDate: ExceptDate?): Self
+
+ /** Sets the `repeatCount`. */
+ public fun setRepeatCount(@Suppress("AutoBoxing") integer: Long?): Self
+
+ /** Sets the `repeatFrequency` to [Duration]. */
+ public fun setRepeatFrequency(duration: Duration): Self =
+ setRepeatFrequency(RepeatFrequency(duration))
+
+ /** Sets the `repeatFrequency` to [String]. */
+ public fun setRepeatFrequency(text: String): Self = setRepeatFrequency(RepeatFrequency(text))
+
+ /** Sets the `repeatFrequency`. */
+ public fun setRepeatFrequency(repeatFrequency: RepeatFrequency?): Self
+
+ /** Sets the `scheduleTimezone`. */
+ public fun setScheduleTimezone(text: String?): Self
+
+ /** Sets the `startDate` to [LocalDate]. */
+ public fun setStartDate(date: LocalDate): Self = setStartDate(StartDate(date))
+
+ /** Sets the `startDate` to [LocalDateTime]. */
+ public fun setStartDate(localDateTime: LocalDateTime): Self =
+ setStartDate(StartDate(localDateTime))
+
+ /** Sets the `startDate` to [ZonedDateTime]. */
+ public fun setStartDate(zonedDateTime: ZonedDateTime): Self =
+ setStartDate(StartDate(zonedDateTime))
+
+ /** Sets the `startDate`. */
+ public fun setStartDate(startDate: StartDate?): Self
+
+ /** Sets the `startTime` to [LocalTime]. */
+ public fun setStartTime(time: LocalTime): Self = setStartTime(StartTime(time))
+
+ /** Sets the `startTime` to [LocalDateTime]. */
+ public fun setStartTime(localDateTime: LocalDateTime): Self =
+ setStartTime(StartTime(localDateTime))
+
+ /** Sets the `startTime` to [ZonedDateTime]. */
+ public fun setStartTime(zonedDateTime: ZonedDateTime): Self =
+ setStartTime(StartTime(zonedDateTime))
+
+ /** Sets the `startTime`. */
+ public fun setStartTime(startTime: StartTime?): Self
+ }
+}
+
+/**
+ * A generic implementation of [Schedule].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MySchedule internal constructor(
+ * schedule: Schedule,
+ * val foo: String,
+ * val bars: List<Int>,
+ * ) : GenericSchedule<
+ * MySchedule,
+ * MySchedule.Builder
+ * >(schedule) {
+ *
+ * override val selfTypeName =
+ * "MySchedule"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun toBuilderWithAdditionalPropertiesOnly(): Builder {
+ * return Builder()
+ * .setFoo(foo)
+ * .addBars(bars)
+ * }
+ *
+ * class Builder :
+ * GenericSchedule.Builder<
+ * Builder,
+ * MySchedule> {...}
+ * }
+ * ```
+ *
+ * Also see [GenericSchedule.Builder].
+ */
+@Suppress("UNCHECKED_CAST")
+public abstract class GenericSchedule<
+ Self : GenericSchedule<Self, Builder>, Builder : GenericSchedule.Builder<Builder, Self>>
+internal constructor(
+ public final override val byDays: List<ByDay>,
+ public final override val byMonths: List<Long>,
+ public final override val byMonthDays: List<Long>,
+ public final override val byMonthWeeks: List<Long>,
+ public final override val endDate: EndDate?,
+ public final override val endTime: EndTime?,
+ public final override val exceptDate: ExceptDate?,
+ @get:Suppress("AutoBoxing") public final override val repeatCount: Long?,
+ public final override val repeatFrequency: RepeatFrequency?,
+ public final override val scheduleTimezone: String?,
+ public final override val startDate: StartDate?,
+ public final override val startTime: StartTime?,
+ public final override val disambiguatingDescription: DisambiguatingDescription?,
+ public final override val identifier: String?,
+ public final override val name: Name?,
+) : Schedule {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ protected abstract val additionalProperties: Map<String, Any?>
+
+ /** A copy-constructor that copies over properties from another [Schedule] instance. */
+ public constructor(
+ schedule: Schedule
+ ) : this(
+ schedule.byDays,
+ schedule.byMonths,
+ schedule.byMonthDays,
+ schedule.byMonthWeeks,
+ schedule.endDate,
+ schedule.endTime,
+ schedule.exceptDate,
+ schedule.repeatCount,
+ schedule.repeatFrequency,
+ schedule.scheduleTimezone,
+ schedule.startDate,
+ schedule.startTime,
+ schedule.disambiguatingDescription,
+ schedule.identifier,
+ schedule.name
+ )
+
+ /** Returns a concrete [Builder] with the additional, non-[Schedule] properties copied over. */
+ protected abstract fun toBuilderWithAdditionalPropertiesOnly(): Builder
+
+ public final override fun toBuilder(): Builder =
+ toBuilderWithAdditionalPropertiesOnly()
+ .addByDays(byDays)
+ .addByMonths(byMonths)
+ .addByMonthDays(byMonthDays)
+ .addByMonthWeeks(byMonthWeeks)
+ .setEndDate(endDate)
+ .setEndTime(endTime)
+ .setExceptDate(exceptDate)
+ .setRepeatCount(repeatCount)
+ .setRepeatFrequency(repeatFrequency)
+ .setScheduleTimezone(scheduleTimezone)
+ .setStartDate(startDate)
+ .setStartTime(startTime)
+ .setDisambiguatingDescription(disambiguatingDescription)
+ .setIdentifier(identifier)
+ .setName(name)
+
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (byDays != other.byDays) return false
+ if (byMonths != other.byMonths) return false
+ if (byMonthDays != other.byMonthDays) return false
+ if (byMonthWeeks != other.byMonthWeeks) return false
+ if (endDate != other.endDate) return false
+ if (endTime != other.endTime) return false
+ if (exceptDate != other.exceptDate) return false
+ if (repeatCount != other.repeatCount) return false
+ if (repeatFrequency != other.repeatFrequency) return false
+ if (scheduleTimezone != other.scheduleTimezone) return false
+ if (startDate != other.startDate) return false
+ if (startTime != other.startTime) return false
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ public final override fun hashCode(): Int =
+ Objects.hash(
+ byDays,
+ byMonths,
+ byMonthDays,
+ byMonthWeeks,
+ endDate,
+ endTime,
+ exceptDate,
+ repeatCount,
+ repeatFrequency,
+ scheduleTimezone,
+ startDate,
+ startTime,
+ disambiguatingDescription,
+ identifier,
+ name,
+ additionalProperties
+ )
+
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (byDays.isNotEmpty()) {
+ attributes["byDays"] = byDays.map { it.toString(includeWrapperName = false) }.toString()
+ }
+ if (byMonths.isNotEmpty()) {
+ attributes["byMonths"] = byMonths.toString()
+ }
+ if (byMonthDays.isNotEmpty()) {
+ attributes["byMonthDays"] = byMonthDays.toString()
+ }
+ if (byMonthWeeks.isNotEmpty()) {
+ attributes["byMonthWeeks"] = byMonthWeeks.toString()
+ }
+ if (endDate != null) {
+ attributes["endDate"] = endDate.toString(includeWrapperName = false)
+ }
+ if (endTime != null) {
+ attributes["endTime"] = endTime.toString(includeWrapperName = false)
+ }
+ if (exceptDate != null) {
+ attributes["exceptDate"] = exceptDate.toString(includeWrapperName = false)
+ }
+ if (repeatCount != null) {
+ attributes["repeatCount"] = repeatCount.toString()
+ }
+ if (repeatFrequency != null) {
+ attributes["repeatFrequency"] = repeatFrequency.toString(includeWrapperName = false)
+ }
+ if (scheduleTimezone != null) {
+ attributes["scheduleTimezone"] = scheduleTimezone
+ }
+ if (startDate != null) {
+ attributes["startDate"] = startDate.toString(includeWrapperName = false)
+ }
+ if (startTime != null) {
+ attributes["startTime"] = startTime.toString(includeWrapperName = false)
+ }
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier
+ }
+ if (name != null) {
+ attributes["name"] = name.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated = attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+
+ /**
+ * A generic implementation of [Schedule.Builder].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MySchedule :
+ * : GenericSchedule<
+ * MySchedule,
+ * MySchedule.Builder>(...) {
+ *
+ * class Builder
+ * : Builder<
+ * Builder,
+ * MySchedule
+ * >() {
+ * private var foo: String? = null
+ * private val bars = mutableListOf<Int>()
+ *
+ * override val selfTypeName =
+ * "MySchedule.Builder"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun buildFromSchedule(
+ * schedule: Schedule
+ * ): MySchedule {
+ * return MySchedule(
+ * schedule,
+ * foo,
+ * bars.toList()
+ * )
+ * }
+ *
+ * fun setFoo(string: String): Builder {
+ * return apply { foo = string }
+ * }
+ *
+ * fun addBar(int: Int): Builder {
+ * return apply { bars += int }
+ * }
+ *
+ * fun addBars(values: Iterable<Int>): Builder {
+ * return apply { bars += values }
+ * }
+ * }
+ * }
+ * ```
+ *
+ * Also see [GenericSchedule].
+ */
+ @Suppress("StaticFinalBuilder")
+ public abstract class Builder<Self : Builder<Self, Built>, Built : GenericSchedule<Built, Self>> :
+ Schedule.Builder<Self> {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val additionalProperties: Map<String, Any?>
+
+ private val byDays: MutableList<ByDay> = mutableListOf()
+
+ private val byMonths: MutableList<Long> = mutableListOf()
+
+ private val byMonthDays: MutableList<Long> = mutableListOf()
+
+ private val byMonthWeeks: MutableList<Long> = mutableListOf()
+
+ private var endDate: EndDate? = null
+
+ private var endTime: EndTime? = null
+
+ private var exceptDate: ExceptDate? = null
+
+ @get:Suppress("AutoBoxing") private var repeatCount: Long? = null
+
+ private var repeatFrequency: RepeatFrequency? = null
+
+ private var scheduleTimezone: String? = null
+
+ private var startDate: StartDate? = null
+
+ private var startTime: StartTime? = null
+
+ private var disambiguatingDescription: DisambiguatingDescription? = null
+
+ private var identifier: String? = null
+
+ private var name: Name? = null
+
+ /**
+ * Builds a concrete [Built] instance, given a built [Schedule].
+ *
+ * Subclasses should override this method to build a concrete [Built] instance that holds both
+ * the [Schedule]-specific properties and the subclass specific [additionalProperties].
+ *
+ * See the sample code in the documentation of this class for more context.
+ */
+ @Suppress("BuilderSetStyle") protected abstract fun buildFromSchedule(schedule: Schedule): Built
+
+ public final override fun build(): Built =
+ buildFromSchedule(
+ ScheduleImpl(
+ byDays.toList(),
+ byMonths.toList(),
+ byMonthDays.toList(),
+ byMonthWeeks.toList(),
+ endDate,
+ endTime,
+ exceptDate,
+ repeatCount,
+ repeatFrequency,
+ scheduleTimezone,
+ startDate,
+ startTime,
+ disambiguatingDescription,
+ identifier,
+ name
+ )
+ )
+
+ public final override fun addByDay(byDay: ByDay): Self {
+ byDays += byDay
+ return this as Self
+ }
+
+ public final override fun addByDays(values: Iterable<ByDay>): Self {
+ byDays += values
+ return this as Self
+ }
+
+ public final override fun clearByDays(): Self {
+ byDays.clear()
+ return this as Self
+ }
+
+ public final override fun addByMonth(integer: Long): Self {
+ byMonths += integer
+ return this as Self
+ }
+
+ public final override fun addByMonths(values: Iterable<Long>): Self {
+ byMonths += values
+ return this as Self
+ }
+
+ public final override fun clearByMonths(): Self {
+ byMonths.clear()
+ return this as Self
+ }
+
+ public final override fun addByMonthDay(integer: Long): Self {
+ byMonthDays += integer
+ return this as Self
+ }
+
+ public final override fun addByMonthDays(values: Iterable<Long>): Self {
+ byMonthDays += values
+ return this as Self
+ }
+
+ public final override fun clearByMonthDays(): Self {
+ byMonthDays.clear()
+ return this as Self
+ }
+
+ public final override fun addByMonthWeek(integer: Long): Self {
+ byMonthWeeks += integer
+ return this as Self
+ }
+
+ public final override fun addByMonthWeeks(values: Iterable<Long>): Self {
+ byMonthWeeks += values
+ return this as Self
+ }
+
+ public final override fun clearByMonthWeeks(): Self {
+ byMonthWeeks.clear()
+ return this as Self
+ }
+
+ public final override fun setEndDate(endDate: EndDate?): Self {
+ this.endDate = endDate
+ return this as Self
+ }
+
+ public final override fun setEndTime(endTime: EndTime?): Self {
+ this.endTime = endTime
+ return this as Self
+ }
+
+ public final override fun setExceptDate(exceptDate: ExceptDate?): Self {
+ this.exceptDate = exceptDate
+ return this as Self
+ }
+
+ public final override fun setRepeatCount(@Suppress("AutoBoxing") integer: Long?): Self {
+ this.repeatCount = integer
+ return this as Self
+ }
+
+ public final override fun setRepeatFrequency(repeatFrequency: RepeatFrequency?): Self {
+ this.repeatFrequency = repeatFrequency
+ return this as Self
+ }
+
+ public final override fun setScheduleTimezone(text: String?): Self {
+ this.scheduleTimezone = text
+ return this as Self
+ }
+
+ public final override fun setStartDate(startDate: StartDate?): Self {
+ this.startDate = startDate
+ return this as Self
+ }
+
+ public final override fun setStartTime(startTime: StartTime?): Self {
+ this.startTime = startTime
+ return this as Self
+ }
+
+ public final override fun setDisambiguatingDescription(
+ disambiguatingDescription: DisambiguatingDescription?
+ ): Self {
+ this.disambiguatingDescription = disambiguatingDescription
+ return this as Self
+ }
+
+ public final override fun setIdentifier(text: String?): Self {
+ this.identifier = text
+ return this as Self
+ }
+
+ public final override fun setName(name: Name?): Self {
+ this.name = name
+ return this as Self
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (byDays != other.byDays) return false
+ if (byMonths != other.byMonths) return false
+ if (byMonthDays != other.byMonthDays) return false
+ if (byMonthWeeks != other.byMonthWeeks) return false
+ if (endDate != other.endDate) return false
+ if (endTime != other.endTime) return false
+ if (exceptDate != other.exceptDate) return false
+ if (repeatCount != other.repeatCount) return false
+ if (repeatFrequency != other.repeatFrequency) return false
+ if (scheduleTimezone != other.scheduleTimezone) return false
+ if (startDate != other.startDate) return false
+ if (startTime != other.startTime) return false
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun hashCode(): Int =
+ Objects.hash(
+ byDays,
+ byMonths,
+ byMonthDays,
+ byMonthWeeks,
+ endDate,
+ endTime,
+ exceptDate,
+ repeatCount,
+ repeatFrequency,
+ scheduleTimezone,
+ startDate,
+ startTime,
+ disambiguatingDescription,
+ identifier,
+ name,
+ additionalProperties
+ )
+
+ @Suppress("BuilderSetStyle")
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (byDays.isNotEmpty()) {
+ attributes["byDays"] = byDays.map { it.toString(includeWrapperName = false) }.toString()
+ }
+ if (byMonths.isNotEmpty()) {
+ attributes["byMonths"] = byMonths.toString()
+ }
+ if (byMonthDays.isNotEmpty()) {
+ attributes["byMonthDays"] = byMonthDays.toString()
+ }
+ if (byMonthWeeks.isNotEmpty()) {
+ attributes["byMonthWeeks"] = byMonthWeeks.toString()
+ }
+ if (endDate != null) {
+ attributes["endDate"] = endDate!!.toString(includeWrapperName = false)
+ }
+ if (endTime != null) {
+ attributes["endTime"] = endTime!!.toString(includeWrapperName = false)
+ }
+ if (exceptDate != null) {
+ attributes["exceptDate"] = exceptDate!!.toString(includeWrapperName = false)
+ }
+ if (repeatCount != null) {
+ attributes["repeatCount"] = repeatCount!!.toString()
+ }
+ if (repeatFrequency != null) {
+ attributes["repeatFrequency"] = repeatFrequency!!.toString(includeWrapperName = false)
+ }
+ if (scheduleTimezone != null) {
+ attributes["scheduleTimezone"] = scheduleTimezone!!
+ }
+ if (startDate != null) {
+ attributes["startDate"] = startDate!!.toString(includeWrapperName = false)
+ }
+ if (startTime != null) {
+ attributes["startTime"] = startTime!!.toString(includeWrapperName = false)
+ }
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription!!.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier!!
+ }
+ if (name != null) {
+ attributes["name"] = name!!.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated =
+ attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+ }
+}
+
+internal class ScheduleImpl : GenericSchedule<ScheduleImpl, ScheduleImpl.Builder> {
+ protected override val selfTypeName: String
+ get() = "Schedule"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ public constructor(
+ byDays: List<ByDay>,
+ byMonths: List<Long>,
+ byMonthDays: List<Long>,
+ byMonthWeeks: List<Long>,
+ endDate: EndDate?,
+ endTime: EndTime?,
+ exceptDate: ExceptDate?,
+ repeatCount: Long?,
+ repeatFrequency: RepeatFrequency?,
+ scheduleTimezone: String?,
+ startDate: StartDate?,
+ startTime: StartTime?,
+ disambiguatingDescription: DisambiguatingDescription?,
+ identifier: String?,
+ name: Name?,
+ ) : super(
+ byDays,
+ byMonths,
+ byMonthDays,
+ byMonthWeeks,
+ endDate,
+ endTime,
+ exceptDate,
+ repeatCount,
+ repeatFrequency,
+ scheduleTimezone,
+ startDate,
+ startTime,
+ disambiguatingDescription,
+ identifier,
+ name
+ )
+
+ public constructor(schedule: Schedule) : super(schedule)
+
+ protected override fun toBuilderWithAdditionalPropertiesOnly(): Builder = Builder()
+
+ internal class Builder : GenericSchedule.Builder<Builder, ScheduleImpl>() {
+ protected override val selfTypeName: String
+ get() = "Schedule.Builder"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ protected override fun buildFromSchedule(schedule: Schedule): ScheduleImpl =
+ schedule as? ScheduleImpl ?: ScheduleImpl(schedule)
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Timer.kt b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Timer.kt
new file mode 100644
index 0000000..b9d5de4
--- /dev/null
+++ b/appactions/builtintypes/builtintypes-core/src/main/java/androidx/appactions/builtintypes/types/Timer.kt
@@ -0,0 +1,356 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package androidx.appactions.builtintypes.types
+
+import androidx.appactions.builtintypes.properties.DisambiguatingDescription
+import androidx.appactions.builtintypes.properties.Name
+import java.time.Duration
+import java.util.Objects
+import kotlin.Any
+import kotlin.Boolean
+import kotlin.Int
+import kotlin.String
+import kotlin.Suppress
+import kotlin.collections.Map
+import kotlin.collections.emptyMap
+import kotlin.collections.joinToString
+import kotlin.collections.map
+import kotlin.collections.mutableMapOf
+import kotlin.collections.plusAssign
+import kotlin.jvm.JvmStatic
+
+/**
+ * A timer to go off at a particular time.
+ *
+ * See http://schema.googleapis.com/Timer for context.
+ *
+ * Should not be directly implemented. More properties may be added over time. Instead consider
+ * using [Companion.Builder] or see [GenericTimer] if you need to extend this type.
+ */
+public interface Timer : Thing {
+ /** The duration of the item (movie, audio recording, event, etc.). */
+ public val duration: Duration?
+
+ /** Converts this [Timer] to its builder with all the properties copied over. */
+ public override fun toBuilder(): Builder<*>
+
+ public companion object {
+ /** Returns a default implementation of [Builder] with no properties set. */
+ @JvmStatic public fun Builder(): Builder<*> = TimerImpl.Builder()
+ }
+
+ /**
+ * Builder for [Timer].
+ *
+ * Should not be directly implemented. More methods may be added over time. See
+ * [GenericTimer.Builder] if you need to extend this builder.
+ */
+ public interface Builder<Self : Builder<Self>> : Thing.Builder<Self> {
+ /** Returns a built [Timer]. */
+ public override fun build(): Timer
+
+ /** Sets the `duration`. */
+ public fun setDuration(duration: Duration?): Self
+ }
+}
+
+/**
+ * A generic implementation of [Timer].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MyTimer internal constructor(
+ * timer: Timer,
+ * val foo: String,
+ * val bars: List<Int>,
+ * ) : GenericTimer<
+ * MyTimer,
+ * MyTimer.Builder
+ * >(timer) {
+ *
+ * override val selfTypeName =
+ * "MyTimer"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun toBuilderWithAdditionalPropertiesOnly(): Builder {
+ * return Builder()
+ * .setFoo(foo)
+ * .addBars(bars)
+ * }
+ *
+ * class Builder :
+ * GenericTimer.Builder<
+ * Builder,
+ * MyTimer> {...}
+ * }
+ * ```
+ *
+ * Also see [GenericTimer.Builder].
+ */
+@Suppress("UNCHECKED_CAST")
+public abstract class GenericTimer<
+ Self : GenericTimer<Self, Builder>, Builder : GenericTimer.Builder<Builder, Self>>
+internal constructor(
+ public final override val duration: Duration?,
+ public final override val disambiguatingDescription: DisambiguatingDescription?,
+ public final override val identifier: String?,
+ public final override val name: Name?,
+) : Timer {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ protected abstract val additionalProperties: Map<String, Any?>
+
+ /** A copy-constructor that copies over properties from another [Timer] instance. */
+ public constructor(
+ timer: Timer
+ ) : this(timer.duration, timer.disambiguatingDescription, timer.identifier, timer.name)
+
+ /** Returns a concrete [Builder] with the additional, non-[Timer] properties copied over. */
+ protected abstract fun toBuilderWithAdditionalPropertiesOnly(): Builder
+
+ public final override fun toBuilder(): Builder =
+ toBuilderWithAdditionalPropertiesOnly()
+ .setDuration(duration)
+ .setDisambiguatingDescription(disambiguatingDescription)
+ .setIdentifier(identifier)
+ .setName(name)
+
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (duration != other.duration) return false
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ public final override fun hashCode(): Int =
+ Objects.hash(duration, disambiguatingDescription, identifier, name, additionalProperties)
+
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (duration != null) {
+ attributes["duration"] = duration.toString()
+ }
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier
+ }
+ if (name != null) {
+ attributes["name"] = name.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated = attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+
+ /**
+ * A generic implementation of [Timer.Builder].
+ *
+ * Allows for extension like:
+ * ```kt
+ * class MyTimer :
+ * : GenericTimer<
+ * MyTimer,
+ * MyTimer.Builder>(...) {
+ *
+ * class Builder
+ * : Builder<
+ * Builder,
+ * MyTimer
+ * >() {
+ * private var foo: String? = null
+ * private val bars = mutableListOf<Int>()
+ *
+ * override val selfTypeName =
+ * "MyTimer.Builder"
+ *
+ * override val additionalProperties: Map<String, Any?>
+ * get() = mapOf("foo" to foo, "bars" to bars)
+ *
+ * override fun buildFromTimer(
+ * timer: Timer
+ * ): MyTimer {
+ * return MyTimer(
+ * timer,
+ * foo,
+ * bars.toList()
+ * )
+ * }
+ *
+ * fun setFoo(string: String): Builder {
+ * return apply { foo = string }
+ * }
+ *
+ * fun addBar(int: Int): Builder {
+ * return apply { bars += int }
+ * }
+ *
+ * fun addBars(values: Iterable<Int>): Builder {
+ * return apply { bars += values }
+ * }
+ * }
+ * }
+ * ```
+ *
+ * Also see [GenericTimer].
+ */
+ @Suppress("StaticFinalBuilder")
+ public abstract class Builder<Self : Builder<Self, Built>, Built : GenericTimer<Built, Self>> :
+ Timer.Builder<Self> {
+ /**
+ * Human readable name for the concrete [Self] class.
+ *
+ * Used in the [toString] output.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val selfTypeName: String
+
+ /**
+ * The additional properties that exist on the concrete [Self] class.
+ *
+ * Used for equality comparison and computing the hash code.
+ */
+ @get:Suppress("GetterOnBuilder") protected abstract val additionalProperties: Map<String, Any?>
+
+ private var duration: Duration? = null
+
+ private var disambiguatingDescription: DisambiguatingDescription? = null
+
+ private var identifier: String? = null
+
+ private var name: Name? = null
+
+ /**
+ * Builds a concrete [Built] instance, given a built [Timer].
+ *
+ * Subclasses should override this method to build a concrete [Built] instance that holds both
+ * the [Timer]-specific properties and the subclass specific [additionalProperties].
+ *
+ * See the sample code in the documentation of this class for more context.
+ */
+ @Suppress("BuilderSetStyle") protected abstract fun buildFromTimer(timer: Timer): Built
+
+ public final override fun build(): Built =
+ buildFromTimer(TimerImpl(duration, disambiguatingDescription, identifier, name))
+
+ public final override fun setDuration(duration: Duration?): Self {
+ this.duration = duration
+ return this as Self
+ }
+
+ public final override fun setDisambiguatingDescription(
+ disambiguatingDescription: DisambiguatingDescription?
+ ): Self {
+ this.disambiguatingDescription = disambiguatingDescription
+ return this as Self
+ }
+
+ public final override fun setIdentifier(text: String?): Self {
+ this.identifier = text
+ return this as Self
+ }
+
+ public final override fun setName(name: Name?): Self {
+ this.name = name
+ return this as Self
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class.java != other::class.java) return false
+ other as Self
+ if (duration != other.duration) return false
+ if (disambiguatingDescription != other.disambiguatingDescription) return false
+ if (identifier != other.identifier) return false
+ if (name != other.name) return false
+ if (additionalProperties != other.additionalProperties) return false
+ return true
+ }
+
+ @Suppress("BuilderSetStyle")
+ public final override fun hashCode(): Int =
+ Objects.hash(duration, disambiguatingDescription, identifier, name, additionalProperties)
+
+ @Suppress("BuilderSetStyle")
+ public final override fun toString(): String {
+ val attributes = mutableMapOf<String, String>()
+ if (duration != null) {
+ attributes["duration"] = duration!!.toString()
+ }
+ if (disambiguatingDescription != null) {
+ attributes["disambiguatingDescription"] =
+ disambiguatingDescription!!.toString(includeWrapperName = false)
+ }
+ if (identifier != null) {
+ attributes["identifier"] = identifier!!
+ }
+ if (name != null) {
+ attributes["name"] = name!!.toString(includeWrapperName = false)
+ }
+ attributes += additionalProperties.map { (k, v) -> k to v.toString() }
+ val commaSeparated =
+ attributes.entries.joinToString(separator = ", ") { (k, v) -> """$k=$v""" }
+ return """$selfTypeName($commaSeparated)"""
+ }
+ }
+}
+
+internal class TimerImpl : GenericTimer<TimerImpl, TimerImpl.Builder> {
+ protected override val selfTypeName: String
+ get() = "Timer"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ public constructor(
+ duration: Duration?,
+ disambiguatingDescription: DisambiguatingDescription?,
+ identifier: String?,
+ name: Name?,
+ ) : super(duration, disambiguatingDescription, identifier, name)
+
+ public constructor(timer: Timer) : super(timer)
+
+ protected override fun toBuilderWithAdditionalPropertiesOnly(): Builder = Builder()
+
+ internal class Builder : GenericTimer.Builder<Builder, TimerImpl>() {
+ protected override val selfTypeName: String
+ get() = "Timer.Builder"
+
+ protected override val additionalProperties: Map<String, Any?>
+ get() = emptyMap()
+
+ protected override fun buildFromTimer(timer: Timer): TimerImpl =
+ timer as? TimerImpl ?: TimerImpl(timer)
+ }
+}
diff --git a/appactions/builtintypes/builtintypes-core/src/test/java/androidx/appactions/builtintypes/types/DataTypeTest.kt b/appactions/builtintypes/builtintypes-core/src/test/java/androidx/appactions/builtintypes/types/DataTypeTest.kt
index 455246c..14f8782 100644
--- a/appactions/builtintypes/builtintypes-core/src/test/java/androidx/appactions/builtintypes/types/DataTypeTest.kt
+++ b/appactions/builtintypes/builtintypes-core/src/test/java/androidx/appactions/builtintypes/types/DataTypeTest.kt
@@ -18,6 +18,7 @@
import androidx.appactions.builtintypes.properties.Name
import com.google.common.truth.Truth.assertThat
+import java.time.LocalDateTime
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@@ -53,4 +54,46 @@
Thing.Builder().setName("John Wick 2").setDisambiguatingDescription("Movie").build()
)
}
+
+ @Test
+ fun testPolymorphicCopying() {
+ val thing1: Thing =
+ Alarm.Builder()
+ .setName("Wake up!")
+ .setAlarmSchedule(
+ Schedule.Builder()
+ .setStartDate(
+ LocalDateTime.of(
+ /* year= */ 2023,
+ /* month= */ 5,
+ /* dayOfMonth= */ 3,
+ /* hour= */ 8,
+ /* minute=*/ 30
+ )
+ )
+ .build()
+ )
+ .build()
+ val thing2 = thing1.toBuilder().setName("Go to bed!").build()
+ assertThat(thing2).isInstanceOf(Alarm::class.java)
+ assertThat(thing2)
+ .isEqualTo(
+ Alarm.Builder()
+ .setName("Go to bed!")
+ .setAlarmSchedule(
+ Schedule.Builder()
+ .setStartDate(
+ LocalDateTime.of(
+ /* year= */ 2023,
+ /* month= */ 5,
+ /* dayOfMonth= */ 3,
+ /* hour= */ 8,
+ /* minute=*/ 30
+ )
+ )
+ .build()
+ )
+ .build()
+ )
+ }
}