import { MessageType , EnumType , ProtoCtx , PrimitiveValue , EnumValue , MessageValue } from '../protobuf' ; import { string as stringType , int32 as int32Type , bool as boolType } from '../primitiveTypes' ; const labType = { tag : 'enum' , name : 'Lab' , options : [ 'lab' , 'no_lab' ] , optionValues : { lab : 0 , no_lab : 1 } , } ; const timeType = { tag : 'enum' , name : 'Time' , options : [ 'morning' , 'afternoon' , 'night' , 'online' ] , optionValues : { morning : 0 , afternoon : 1 , night : 2 , online : 3 } , } ; const gradeType = { tag : 'enum' , name : 'Grade' , options : [ 'Freshman' , 'Sophomore' , 'Junior' , 'Senior' ] , optionValues : { Freshman : 0 , Sophomore : 1 , Junior : 2 , Senior : 3 } , } ; const titleType = { tag : 'enum' , name : 'Title' , options : [ 'Lecturer' , 'Professor' ] , optionValues : { Lecturer : 0 , Professor : 1 } , } ; const personType = { tag : 'message' , name : 'Person' , singleFields : [ [ 'first_name' , 'string' ] , [ 'age' , 'int32' ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const studentType = { tag : 'message' , name : 'Student' , singleFields : [ [ 'person' , 'Person' ] , [ 'grade' , 'Grade' ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const instructorType = { tag : 'message' , name : 'Instructor' , singleFields : [ [ 'person' , 'Person' ] , [ 'title' , 'Title' ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; export const classType = { tag : 'message' , name : 'Class' , singleFields : [ [ 'course_name' , 'string' ] , [ 'course_number' , 'int32' ] , [ 'lab' , 'Lab' ] , [ 'isRegistered' , 'bool' ] , ] , repeatedFields : [ [ 'students' , 'Student' ] , [ 'instructors' , 'Instructor' ] , ] , oneOfFields : [ [ 'class_hours' , [ [ 'hours' , 'string' ] , [ 'time' , 'Time' ] , ] , ] , ] , mapFields : [ ] , } ; export const sampleCtx2 = { types : { string : stringType , int32 : int32Type , bool : boolType , Student : studentType , Person : personType , Instructor : instructorType , Time : timeType , Lab : labType , Grade : gradeType , Title : titleType , Class : classType , } , descriptorJson : '{}' , } ; const courseNameValue = { type : stringType , value : 'Math221' , } ; const courseNumberValue = { type : int32Type , value : '221' , } ; const student1FirstNameValue = { type : stringType , value : 'Louis' , } ; const student1AgeValue = { type : int32Type , value : '23' , } ; const student1GradeValue = { type : gradeType , selected : 'Junior' , } ; const student2FirstNameValue = { type : stringType , value : 'Inchan' , } ; const student2AgeValue = { type : int32Type , value : '24' , } ; const student2GradeValue = { type : gradeType , selected : 'Senior' , } ; const instructor1FirstNameValue = { type : stringType , value : 'Duvall' , } ; const instructor1AgeValue = { type : int32Type , value : '50' , } ; const instructor1TitleValue = { type : titleType , selected : 'Lecturer' , } ; const labValue = { type : labType , selected : 'no_lab' , } ; const hoursValue = { type : stringType , value : '08:30' , } ; const timeValue = { type : timeType , selected : 'morning' , } ; const isRegisteredValue = { type : boolType , value : 'true' , } ; const person1Value = { type : personType , singleFields : [ [ 'first_name' , student1FirstNameValue ] , [ 'age' , student1AgeValue ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const person2Value = { type : personType , singleFields : [ [ 'first_name' , student2FirstNameValue ] , [ 'age' , student2AgeValue ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const person3Value = { type : personType , singleFields : [ [ 'first_name' , instructor1FirstNameValue ] , [ 'age' , instructor1AgeValue ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const student1Value = { type : studentType , singleFields : [ [ 'person' , person1Value ] , [ 'grade' , student1GradeValue ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const student2Value = { type : studentType , singleFields : [ [ 'person' , person2Value ] , [ 'grade' , student2GradeValue ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; const instructor1Value = { type : instructorType , singleFields : [ [ 'person' , person3Value ] , [ 'title' , instructor1TitleValue ] , ] , repeatedFields : [ ] , oneOfFields : [ ] , mapFields : [ ] , } ; export const classValue = { type : classType , singleFields : [ [ 'course_name' , courseNameValue ] , [ 'course_number' , courseNumberValue ] , [ 'isRegistered' , isRegisteredValue ] , [ 'lab' , labValue ] , ] , repeatedFields : [ [ 'students' , [ student1Value , student2Value ] ] , [ 'instructors' , [ instructor1Value ] ] , ] , oneOfFields : [ [ 'class_hours' , [ 'time' , timeValue ] ] ] , mapFields : [ ] , } ; export const test4UserExpectedJson = { course_name : 'Math221' , course_number : 221 , isRegistered : true , lab : 1 , time : 0 , students : [ { person : { first_name : 'Louis' , age : 23 } , grade : 2 } , { person : { first_name : 'Inchan' , age : 24 } , grade : 3 } , ] , instructors : [ { person : { first_name : 'Duvall' , age : 50 } , title : 0 } ] , } ;