# Swagger Petstore
# 
# This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.
# 
# OpenAPI spec version: 1.0.0
# Contact: apiteam@swagger.io
# Generated by: https://github.com/swagger-api/swagger-codegen.git



#' Order Class
#' @export
Order <- R6::R6Class(
  'Order',
  public = list(
    `id` = NULL,
    `petId` = NULL,
    `quantity` = NULL,
    `shipDate` = NULL,
    `status` = NULL,
    `complete` = NULL,
    initialize = function(`id`, `petId`, `quantity`, `shipDate`, `status`, `complete`){
      if (!missing(`id`)) {
        stopifnot(is.numeric(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`petId`)) {
        stopifnot(is.numeric(`petId`), length(`petId`) == 1)
        self$`petId` <- `petId`
      }
      if (!missing(`quantity`)) {
        stopifnot(is.numeric(`quantity`), length(`quantity`) == 1)
        self$`quantity` <- `quantity`
      }
      if (!missing(`shipDate`)) {
        stopifnot(is.character(`shipDate`), length(`shipDate`) == 1)
        self$`shipDate` <- `shipDate`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
      if (!missing(`complete`)) {
        self$`complete` <- `complete`
      }
    },
    toJSON = function() {
       sprintf(
        '{
           "id": %d,
           "petId": %d,
           "quantity": "%s",
           "shipDate": "%s",
           "status": "%s",
           "complete": "%s"
        }',
        self$`id`,
        self$`petId`,
        self$`quantity`,
        self$`shipDate`,
        self$`status`,
        self$`complete`
      )
    },
    fromJSON = function(OrderJson) {
      OrderObject <- jsonlite::fromJSON(OrderJson)
      self$`id` <- OrderObject$`id`
      self$`petId` <- OrderObject$`petId`
      self$`quantity` <- OrderObject$`quantity`
      self$`shipDate` <- OrderObject$`shipDate`
      self$`status` <- OrderObject$`status`
      self$`complete` <- OrderObject$`complete`
    }
  )
)

#' Element Class
#'
#' Element Class
#' @export
Element  <- R6::R6Class(
  'Element',
  public = list(
    id = NULL,
    name = NULL,
    initialize = function(id,name){
      if (!missing(id)) {
        stopifnot(is.numeric(id), length(id) == 1)
        self$id <- id
      }
      if (!missing(name)) {
        stopifnot(is.character(name), length(name) == 1)
        self$name <- name
      }
    },
    toJSON = function() {
       sprintf('{"id":%d,"name":"%s"}', self$id, self$name)
    }
  )
)

#' Response Class
#'
#' Response Class
#' @export
Response  <- R6::R6Class(
  'Response',
  public = list(
    content = NULL,
    response = NULL,
    initialize = function(content, response){
      self$content <- content
      self$response <- response
    }
  )
)
