package com.exquisite.data;

import androidx.room.Entity;
import androidx.room.PrimaryKey;

import com.exquisite.KeyboardSkin;

import java.util.ArrayList;
import java.util.List;

@Entity(tableName = KeyboardSkin.Table_Name)
public class Mydata {
    @PrimaryKey(autoGenerate = true)
    public int id;
    public String preview;
    public String thumb;
    public String className;
    public String title;
    public String zipUrl;
    public Boolean islike;
    public Boolean isDownloaded;
    public String path;

    public String getPreview() {
        return preview;
    }

    public void setPreview(String preview) {
        this.preview = preview;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getZipUrl() {
        return zipUrl;
    }

    public void setZipUrl(String zipUrl) {
        this.zipUrl = zipUrl;
    }

    public Boolean getIslike() {
        return islike;
    }

    public void setIslike(Boolean islike) {
        this.islike = islike;
    }

    public Boolean getDownloaded() {
        return isDownloaded;
    }

    public void setDownloaded(Boolean downloaded) {
        isDownloaded = downloaded;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public List<Mydata> filterByName(String input, List<Mydata> dataList) {
        List<Mydata> filteredList = new ArrayList<>();
        for (Mydata data : dataList) {
            if (data.getTitle().toLowerCase().contains(input.toLowerCase())) {
                filteredList.add(data);
            }
        }
        return filteredList;
    }
}
