import { Entity , Identifier , Serializer } from "ddd-base" ; import { SubscriptionContentBody } from "./SubscriptionContentBody" ; import { TimeStamp , TimeStampJSON , TimeStampSerializer } from "../TimeStamp" ; export const SubscriptionContentSerializer = { toJSON ( entity ) { return { id : entity . id . toValue ( ) , author : entity . author , publishedDate : TimeStampSerializer . toJSON ( entity . publishedDate ) , updatedDate : TimeStampSerializer . toJSON ( entity . updatedDate ) , title : entity . title , body : entity . body . HTMLString , url : entity . url } ; } , fromJSON ( json ) { return new SubscriptionContent ( { id : new SubscriptionContentIdentifier ( json . id ) , author : json . author , publishedDate : TimeStampSerializer . fromJSON ( json . publishedDate ) , updatedDate : TimeStampSerializer . fromJSON ( json . updatedDate ) , title : json . title , body : new SubscriptionContentBody ( json . body ) , url : json . url } ) ; } } ; export interface SubscriptionContentJSON { id : string ; author : string ; publishedDate : TimeStampJSON ; updatedDate : TimeStampJSON ; title : string ; body : string ; url : string ; } export class SubscriptionContentIdentifier extends Identifier < string > { } export interface SubscriptionContentArgs { id : SubscriptionContentIdentifier ; author : string ; publishedDate : TimeStamp ; updatedDate : TimeStamp ; title : string ; body : SubscriptionContentBody ; url : string ; } export class SubscriptionContent extends Entity < SubscriptionContentArgs > { id : SubscriptionContentIdentifier ; author : string ; publishedDate : TimeStamp ; updatedDate : TimeStamp ; title : string ; body : SubscriptionContentBody ; url : string ; constructor ( args ) { super ( args ) ; this . id = args . id ; this . author = args . author ; this . publishedDate = args . publishedDate ; this . updatedDate = args . updatedDate ; this . title = args . title ; this . body = args . body ; this . url = args . url ; } }