// Path: src/main/java/com/yet/dsync/dto/DropboxChangeType.java
// public enum DropboxChangeType {
//     DELETE,
// 
//     FOLDER,
// 
//     FILE;
// 
// 
//     public static DropboxChangeType fromMetadata(final Metadata metadata) {
//         if (metadata instanceof DeletedMetadata) {
//             return DropboxChangeType.DELETE;
// 
//         } else if (metadata instanceof FolderMetadata) {
//             return DropboxChangeType.FOLDER;
// 
//         } else if (metadata instanceof FileMetadata) {
//             return DropboxChangeType.FILE;
// 
//         } else {
//             throw new DSyncClientException("Unknow Metadata class " + metadata.getClass());
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/yet/dsync/dto/DropboxFileData.java
// @Data
// @Builder(toBuilder = true)
// public final class DropboxFileData {
// 
//     private final DropboxChangeType changeType;
// 
//     private final String pathDisplay;
// 
//     private final String pathLower;
// 
//     private final String id;
// 
//     private final String rev;
// 
//     private final Long size;
// 
//     private final LocalDateTime serverModified;
// 
//     private final LocalDateTime clientModified;
// 
//     public boolean isFile() {
//         return rev != null;
//     }
// 
//     public boolean isDirectory() {
//         return id != null && rev == null;
//     }
// 
//     @Override
//     public String toString() {
//         String str = this.getClass().getSimpleName() + " [" + changeType + " " + pathDisplay;
// 
//         if (DropboxChangeType.FOLDER == changeType) {
//             str += ", id: " + id;
//         } else if (DropboxChangeType.FILE == changeType) {
//             str += ", id: " + id + ", rev: " + rev + ", size: " + size
//                     + ", client: " + clientModified + ", server: " + serverModified;
//         }
// 
//         str += "]";
//         return str;
//     }
// }


import com.dropbox.core.v2.files.FileMetadata;
import com.dropbox.core.v2.files.FolderMetadata;
import com.dropbox.core.v2.files.Metadata;
import com.yet.dsync.dto.DropboxChangeType;
import com.yet.dsync.dto.DropboxFileData;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;

/*
 * Copyright (c) 2017 Yuriy Tkach
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package com.yet.dsync.util;



public final class DropboxUtil {

    private DropboxUtil() { }


// Path: src/main/java/com/yet/dsync/dto/DropboxChangeType.java
// public enum DropboxChangeType {
//     DELETE,
// 
//     FOLDER,
// 
//     FILE;
// 
// 
//     public static DropboxChangeType fromMetadata(final Metadata metadata) {
//         if (metadata instanceof DeletedMetadata) {
//             return DropboxChangeType.DELETE;
// 
//         } else if (metadata instanceof FolderMetadata) {
//             return DropboxChangeType.FOLDER;
// 
//         } else if (metadata instanceof FileMetadata) {
//             return DropboxChangeType.FILE;
// 
//         } else {
//             throw new DSyncClientException("Unknow Metadata class " + metadata.getClass());
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/yet/dsync/dto/DropboxFileData.java
// @Data
// @Builder(toBuilder = true)
// public final class DropboxFileData {
// 
//     private final DropboxChangeType changeType;
// 
//     private final String pathDisplay;
// 
//     private final String pathLower;
// 
//     private final String id;
// 
//     private final String rev;
// 
//     private final Long size;
// 
//     private final LocalDateTime serverModified;
// 
//     private final LocalDateTime clientModified;
// 
//     public boolean isFile() {
//         return rev != null;
//     }
// 
//     public boolean isDirectory() {
//         return id != null && rev == null;
//     }
// 
//     @Override
//     public String toString() {
//         String str = this.getClass().getSimpleName() + " [" + changeType + " " + pathDisplay;
// 
//         if (DropboxChangeType.FOLDER == changeType) {
//             str += ", id: " + id;
//         } else if (DropboxChangeType.FILE == changeType) {
//             str += ", id: " + id + ", rev: " + rev + ", size: " + size
//                     + ", client: " + clientModified + ", server: " + serverModified;
//         }
// 
//         str += "]";
//         return str;
//     }
// }


// Path: src/main/java/com/yet/dsync/util/DropboxUtil.java
import com.dropbox.core.v2.files.FileMetadata;
import com.dropbox.core.v2.files.FolderMetadata;
import com.dropbox.core.v2.files.Metadata;
import com.yet.dsync.dto.DropboxChangeType;
import com.yet.dsync.dto.DropboxFileData;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;

/*
 * Copyright (c) 2017 Yuriy Tkach
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package com.yet.dsync.util;



public final class DropboxUtil {

    private DropboxUtil() { }


    public static DropboxFileData convertMetadata(final Metadata metadata) {
