#ifndef FILE_TYPES_HPP
#define FILE_TYPES_HPP

#include <complex>
#include <cstring>
#include <string>

enum fileType { mp4, avi, mkv, mov, flv, webm, unknown };

bool isVideoFile(std::string filename, fileType &type);

class file {
  private:
	std::string filename;
	fileType type;

  public:
	file() : filename(""), type(unknown) {}

	file(const char *fname, fileType ftype) {
		this->filename = std::string(fname);
		this->type = ftype;
	}

	file(const char *fname) {
		filename = std::string(fname);
		if (!isVideoFile(fname, this->type)) {
			type = unknown;
		}
	}

	file(const std::string &fname, fileType ftype) {
		this->filename = fname;
		this->type = ftype;
	}

	fileType getType() const {
		return type;
	}

	std::string getFilename() const {
		return filename;
	}

	void setType(fileType ftype) {
		this->type = ftype;
	}

	void setFilename(const std::string &fname) {
		this->filename = fname;
        if (!isVideoFile(fname.c_str(), this->type)) {
            type = unknown;
        }
	}

	void setFilename(const char *fname) {
		this->filename = std::string(fname);
        if (!isVideoFile(fname, this->type)) {
            type = unknown;
        }
	}

    bool operator==(const file &other) const {
        return this->getType() == other.getType();
    }
};

#endif // FILE_TYPES_HPP
