iptv/scripts/models/subdivision.ts
2025-03-29 11:39:46 +03:00

27 lines
527 B
TypeScript

import { Dictionary } from '@freearhey/core'
import { Country } from '.'
type SubdivisionData = {
code: string
name: string
country: string
}
export class Subdivision {
code: string
name: string
countryCode: string
country?: Country
constructor(data: SubdivisionData) {
this.code = data.code
this.name = data.name
this.countryCode = data.country
}
withCountry(countriesGroupedByCode: Dictionary): this {
this.country = countriesGroupedByCode.get(this.countryCode)
return this
}
}