2020-10-20 21:50:53 +02:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
2020-10-21 03:58:48 +02:00
|
|
|
import {IBlock} from '../blocks/block'
|
2020-10-15 02:35:15 +02:00
|
|
|
|
2020-10-21 03:28:55 +02:00
|
|
|
import {MutableBlock} from './block'
|
|
|
|
|
|
|
|
interface Card extends IBlock {
|
|
|
|
readonly icon: string
|
|
|
|
readonly properties: Readonly<Record<string, string>>
|
|
|
|
}
|
|
|
|
|
|
|
|
class MutableCard extends MutableBlock {
|
2020-10-20 21:50:53 +02:00
|
|
|
get icon(): string {
|
|
|
|
return this.fields.icon as string
|
|
|
|
}
|
|
|
|
set icon(value: string) {
|
|
|
|
this.fields.icon = value
|
|
|
|
}
|
2020-10-15 02:35:15 +02:00
|
|
|
|
2020-10-20 21:50:53 +02:00
|
|
|
get properties(): Record<string, string> {
|
|
|
|
return this.fields.properties as Record<string, string>
|
|
|
|
}
|
|
|
|
set properties(value: Record<string, string>) {
|
|
|
|
this.fields.properties = value
|
|
|
|
}
|
2020-10-15 02:35:15 +02:00
|
|
|
|
2020-10-20 21:50:53 +02:00
|
|
|
constructor(block: any = {}) {
|
|
|
|
super(block)
|
2020-10-20 21:52:56 +02:00
|
|
|
this.type = 'card'
|
2020-10-15 02:35:15 +02:00
|
|
|
|
2020-10-20 21:50:53 +02:00
|
|
|
this.properties = {...(block.fields?.properties || {})}
|
|
|
|
}
|
2020-10-15 02:35:15 +02:00
|
|
|
}
|
|
|
|
|
2020-10-21 03:28:55 +02:00
|
|
|
export {MutableCard, Card}
|