         }
     }
 
+    var fileExtension: FileExtension? {
+        switch self {
+        case .Image:
+            return .Image
+        case .Video:
+            return .Video
+        case .Audio:
+            return .Audio
+        default:
+            return nil
+        }
+    }
+
     var placeholder: String? {
         switch self {
         case .Text:

    case Video = "video"
}


class Attachment: Object {

    dynamic var kind: String = ""

    case NoDownload     = 0 // 未下载
    case Downloading    = 1 // 下载中
    case Downloaded     = 2 // 已下载
}

enum FileExtension: String {
    case Image = "jpg"
    case Video = "mp4"
    case Audio = "m4a"
}

enum MessageMediaType: Int, CustomStringConvertible {
