First of all, let's define our Genre enum. We'll use a string enum since this will be the easiest to understand:
enum Genre {
Horror = "Horror",
Fantastic = "Fantastic",
Thriller = "Thriller",
Romance = "Romance",
Fiction = "Fiction"
}
Next, we can implement the base Media class:
abstract class Media {
private _identifier: string;
protected constructor(
private _name: string,
private _description: string,
private _pictureLocation: string,
private _genre: Genre,
identifier?: string,
) {
if (identifier) {
this._identifier = identifier;
} else {
// this is just for the example; for any real project, use
// UUIDs instead: https://www.npmjs.com/package...