# Renders a calendar for the publishing-api.
class CalendarContentItem
  attr_reader :calendar

  def initialize(calendar)
    @calendar = calendar
  end

  def base_path
    '/' + calendar.slug
  end

  def payload
    {
      title: calendar.title,
      content_id: calendar.content_id,
      format: 'placeholder_calendar',
      publishing_app: 'calendars',
      rendering_app: 'calendars',
      update_type: 'minor',
      locale: 'en',
      public_updated_at: Time.now,
      routes: [
        { type: 'exact', path: base_path }
      ]
    }
  end
end

# Renders a calendar for the publishing-api.
class CalendarContentItem
  attr_reader :calendar

  def initialize(calendar)
    @calendar = calendar
  end

  def base_path
    '/' + calendar.slug
  end

  def payload
    {
      title: calendar.title,
      content_id: calendar.content_id,
      format: 'placeholder_calendar',
      publishing_app: 'calendars',
      rendering_app: 'calendars',
      update_type: 'minor',
      locale: 'en',
      public_updated_at: Time.current.to_datetime.rfc3339,
      routes: [
        { type: 'exact', path: base_path }
      ]
    }
  end
end

Update public_updated_at to rfc3339 format
Update public_updated_at to rfc3339 format

Without this format, it does not validate against `GovukContentSchemaTestHelpers::Validator` and throws error: "The property '#/public_updated_at' must be a valid RFC3339 date/time string in schema file:///var/govuk/govuk-content-schemas/dist/formats/placeholder/publisher/schema.json#"
