aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/RecipePreview.ts
blob: 33b5e1432ec6996b2ee19bafd5cb65afcf3baf93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
interface IRecipePreview {
  id: string;
  name: string;
  icon: string;
  featured: boolean;
  aliases: string[];
  isDevRecipe?: boolean;
  icons?: {
    svg: string;
  };
}

export default class RecipePreview {
  id: string = '';

  name: string = '';

  icon: string = '';

  featured: boolean = false;

  aliases: string[] = [];

  isDevRecipe?: boolean;

  icons?: {
    svg: string;
  };

  constructor(data: IRecipePreview) {
    if (!data) {
      throw new Error('RecipePreview config not valid');
    }

    if (!data.id) {
      throw new Error(`RecipePreview '${data.name}' requires Id`);
    }

    Object.assign(this, data);
  }
}