import { User } from '../../shared/models' ; export class BoardData { constructor ( public title = '' , public id = 0 , public name = '' , public is_active = true , public columns = [ ] , public categories = [ ] , public issue_trackers = [ ] , public users = [ ] , public categoryDefaultColor = '#ffffe0' , public newColumnName = '' , public newCategoryName = '' , public issueTrackerUrl = '' , public issueTrackerBugId = '' ) { } addColumn ( ) { if ( this . newColumnName === '' ) { return ; } this . columns . push ( { name : this . newColumnName , position : this . columns . length } ) ; this . newColumnName = '' ; } removeColumn ( column ) { const index = this . columns . indexOf ( column ) ; if ( index === - 1 ) { return ; } this . columns . splice ( index , 1 ) ; } addCategory ( ) { if ( this . newCategoryName === '' ) { return ; } this . categories . push ( { name : this . newCategoryName , default_task_color : this . categoryDefaultColor } ) ; this . newCategoryName = '' ; } removeCategory ( category ) { const index = this . categories . indexOf ( category ) ; if ( index === - 1 ) { return ; } this . categories . splice ( index , 1 ) ; } addIssueTracker ( ) { if ( this . issueTrackerUrl === '' || this . issueTrackerBugId === '' ) { return ; } this . issue_trackers . push ( { url : this . issueTrackerUrl , regex : this . issueTrackerBugId } ) ; this . issueTrackerUrl = '' ; this . issueTrackerBugId = '' ; } removeIssueTracker ( tracker ) { const index = this . issue_trackers . indexOf ( tracker ) ; if ( index === - 1 ) { return ; } this . issue_trackers . splice ( index , 1 ) ; } }