import { IconTypes } from '../../business/constants/icons';
import { EntityIconDTO } from '../dataTransferObjects/icons';
import { SerializationClass } from './serializationClass';

export class IconSC extends SerializationClass<string, EntityIconDTO> {
    serialize(icon: string): EntityIconDTO {
        return {
            custom: icon.includes('https'),
            type: icon.includes('https') ? IconTypes.IMAGE : IconTypes.EMOJI,
            value: icon,
        };
    }
}
