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 LocalVideoInfo implements Serializable, Parcelable {
    private static final long serialVersionUID = 717025987339126008L;

    String localPath;
    String file;
    String file_name;
    String file_md5;
    long file_size;
    long duration;

    public  LocalVideoInfo(){}


    protected LocalVideoInfo(Parcel in) {
        localPath = in.readString();
        file = in.readString();
        file_name = in.readString();
        file_md5 = in.readString();
        file_size = in.readLong();
        duration = in.readLong();
    }

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

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

    public String getLocalPath() {
        return localPath;
    }

    public void setLocalPath(String localPath) {
        this.localPath = localPath;
    }

    public String getFile() {
        return file;
    }

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

    public String getFile_name() {
        return file_name;
    }

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

    public String getFile_md5() {
        return file_md5;
    }

    public void setFile_md5(String file_md5) {
        this.file_md5 = file_md5;
    }

    public long getFile_size() {
        return file_size;
    }

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

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }


    @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(localPath);
        dest.writeString(file);
        dest.writeString(file_name);
        dest.writeString(file_md5);
        dest.writeLong(file_size);
        dest.writeLong(duration);
    }
}
