aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/RecipePreview.ts
blob: fb8cb3e3ee702109d11e8bafe18009130f47b11a (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
interface IRecipePreview {
  id: string;
  name: string;
  icon: string;
  featured: boolean;
  aliases: string[];
}

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

  name: string = '';

  icon: string = '';

  featured: boolean = false;

  aliases: 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);
  }
}