import * as O from 'fp-ts/Option';
import { getOrError } from '../../../../utils';
export class BenefitItemDto {
  static fromDraftBenefit(draft) {
    return {
      title: getOrError(draft.title),
      subtitle: getOrError(draft.subtitle),
      category: getOrError(draft.category),
      description: O.toNullable(draft.description),
      url: O.toNullable(draft.url),
      attachments: O.fold(() => [], (value) => [value])(draft.attachment),
      icon: O.toNullable(draft.icon),
      backdrop: null
    };
  }
}
