aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/RecipePreview.ts
blob: 4d2cc84500f0f4933ea309e3cb7a4cc9648d5f58 (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
// @flow

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 Error('RecipePreview config not valid');
    }

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

    Object.assign(this, data);
  }
}