mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-11 17:40:05 -04:00
27 lines
472 B
TypeScript
27 lines
472 B
TypeScript
import type { CategoryData, CategorySerializedData } from '~/types/category'
|
|
|
|
export class Category {
|
|
id: string
|
|
name: string
|
|
|
|
constructor(data?: CategoryData) {
|
|
if (!data) return
|
|
|
|
this.id = data.id
|
|
this.name = data.name
|
|
}
|
|
|
|
serialize(): CategorySerializedData {
|
|
return {
|
|
id: this.id,
|
|
name: this.name
|
|
}
|
|
}
|
|
|
|
deserialize(data: CategorySerializedData): this {
|
|
this.id = data.id
|
|
this.name = data.name
|
|
|
|
return this
|
|
}
|
|
}
|