       required = try container.decode(Bool.self, forKey: .required)
       options = try container.decodeIfPresent([InputOption].self, forKey: .options)
       title = try container.decode(String.self, forKey: .title)
-      type = try container.decode(InputType.self, forKey: .type)
+      let type = try container.decode(InputType.self, forKey: .type)
       
       switch type {
       case .longText:

      try container.encode(id, forKey: .id)
      try container.encode(required, forKey: .required)
      try container.encode(title, forKey: .title)
      try container.encode(type, forKey: .type)
      try container.encodeIfPresent(options, forKey: .options)
      
      switch value {
      case .singleSelection(let optionId):
        try container.encode(optionId, forKey: .value)

      case .requestReturnTrip:
        let specifiedReturnDate = try container.decode(String.self, forKey: .value)
        value = Self.convertStringReturnDateToInputValue(specifiedReturnDate)
      case .number:
        let rawValue = try container.decode(String.self, forKey: .value)
        let minValue = try container.decodeIfPresent(Int.self, forKey: .minValue)
        let maxValue = try container.decodeIfPresent(Int.self, forKey: .maxValue)
        value = .number(Int(rawValue) ?? 0, min: minValue, max: maxValue)
      }
    }
    
