package com.hainaos.vc.bean;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

import com.google.gson.Gson;
import com.google.gson.JsonParser;

import java.io.Serializable;

public class PhotoInfo implements Serializable, Parcelable {
    private static final long serialVersionUID = 4205742067664126524L;

    String file_name;
    String file;
    long file_size;

    protected PhotoInfo(Parcel in) {
        file_name = in.readString();
        file = in.readString();
        file_size = in.readLong();
    }

    public static final Creator<PhotoInfo> CREATOR = new Creator<PhotoInfo>() {
        @Override
        public PhotoInfo createFromParcel(Parcel in) {
            return new PhotoInfo(in);
        }

        @Override
        public PhotoInfo[] newArray(int size) {
            return new PhotoInfo[size];
        }
    };

    public String getFile_name() {
        return file_name;
    }

    public void setFile_name(String file_name) {
        this.file_name = file_name;
    }

    public String getFile() {
        return file;
    }

    public void setFile(String file) {
        this.file = file;
    }

    public long getFile_size() {
        return file_size;
    }

    public void setFile_size(long file_size) {
        this.file_size = file_size;
    }

    @NonNull
    @Override
    public String toString() {
        return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(file_name);
        dest.writeString(file);
        dest.writeLong(file_size);
    }
}
