import { Injectable } from '@angular/core' import { HttpWrapperService } from './http-wrapper.service'; import { ApiResult } from '../resources/utility_models/api_result'; import { TournamentFilter, AttendeeLocationGroup, TournamentSummary, Tournament, TournamentAvailabilitySummary, TournamentTicketSlice, AttendeeTournamentView, FutureTournamentSummary, ArmyListsReview_Competition, ArmyListsSummary_Tournament } from 'tournee.businesslogic'; @Injectable() export class TournamentService { constructor(private http: HttpWrapperService) {} search(filter: TournamentFilter) { return this.http.insecureGet>>('/tournaments/search/' + filter.send_object()); } get_summary(filter: TournamentFilter) { return this.http.insecureGet>>('/tournaments/search/' + filter.send_object()); } get_availability(filter: TournamentFilter) { return this.http.insecureGet>>('/tournaments/availability/' + filter.send_object()); } get_slices(filter: TournamentFilter) { return this.http.insecureGet>>('/tournaments/availability/' + filter.send_object()); } get_future_summary() { return this.http.insecureGet>('/tournaments/future'); } get_permissions(tournament_id: string) { return this.http.insecureGet>>('/tournaments/' + tournament_id + '/permissions'); } get_attendee_location_groups(tournament_id: string) { return this.http.secureGet>>('/tournaments/' + tournament_id + '/attendee_location_groups'); } get(id) { return this.http.secureGet>>('/tournaments/' + id); } update(data : Tournament) { return this.http.securePut>>('/tournaments/' + data.id, data.save_object()); } delete(id: string) { return this.http.secureDelete>>('/tournaments/' + id); } publish(data: Tournament) { return this.http.securePut>>('/tournaments/' + data.id + '/publish', data.save_object()); } validateUrl(tournament_id: string, url: string) { return this.http.secureGet>('/tournaments/' + tournament_id + '/validaturl/' + url); } get_army_list_summaries(tournament_id: string) { return this.http.secureGet>('/tournaments/' + tournament_id + '/lists/'); } get_for_review(tournament_id: string, competition_id: string, user_ids: Array) { return this.http.secureGet>('/tournaments/' + tournament_id + '/lists/' + competition_id + '/review?pid=' + user_ids); } get_next_for_review(tournament_id: string, competition_id: string) { return this.http.secureGet>>('/tournaments/' + tournament_id + '/lists/' + competition_id + '/review/next'); } clear_review(tournament_id: string, competition_id: string, user_ids: Array) { return this.http.secureDelete('/tournaments/' + tournament_id + '/lists/' + competition_id + '/review?pid=' + user_ids); } submit_list_review(tournament_id: string, competition_id: string, results) { return this.http.securePost>('/tournaments/' + tournament_id + '/lists/' + competition_id + '/review', results); } }