Module: CoachZed::ScheduleSchema

Defined in:
lib/coach_zed/schedule_schema.rb

Class Method Summary collapse

Class Method Details

.to_hObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/coach_zed/schedule_schema.rb', line 7

def to_h
  {
    type: "object",
    properties: {
      program_name: {type: "string"},
      program_length_days: {type: "integer"},
      days: {
        type: "array",
        items: {
          type: "object",
          properties: {
            day_number: {type: "integer"},
            day_type: {
              type: "string",
              enum: %w[workout rest]
            },
            workout: {
              anyOf: [
                {
                  type: "object",
                  properties: {
                    title: {type: "string"},
                    catalog_path: {type: "string"},
                    domain: {type: "string"},
                    session_duration: {type: "string"}
                  },
                  required: %w[title catalog_path domain session_duration],
                  additionalProperties: false
                },
                {type: "null"}
              ]
            },
            notes: {type: "string"}
          },
          required: %w[day_number day_type workout notes],
          additionalProperties: false
        }
      }
    },
    required: %w[program_name program_length_days days],
    additionalProperties: false
  }
end