mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-13 10:30:05 -04:00
31 lines
642 B
TypeScript
31 lines
642 B
TypeScript
import type { SubdivisionData, SubdivisionSerializedData } from '~/types/subdivision'
|
|
|
|
export class Subdivision {
|
|
code: string
|
|
name: string
|
|
countryCode: string
|
|
|
|
constructor(data?: SubdivisionData) {
|
|
if (!data) return
|
|
|
|
this.code = data.code
|
|
this.name = data.name
|
|
this.countryCode = data.country
|
|
}
|
|
|
|
serialize(): SubdivisionSerializedData {
|
|
return {
|
|
code: this.code,
|
|
name: this.name,
|
|
countryCode: this.countryCode
|
|
}
|
|
}
|
|
|
|
deserialize(data: SubdivisionSerializedData): this {
|
|
this.code = data.code
|
|
this.name = data.name
|
|
this.countryCode = data.countryCode
|
|
|
|
return this
|
|
}
|
|
}
|