{
  "version": 3,
  "sources": ["src/app/_services/collection-tag.service.ts"],
  "sourcesContent": ["import {HttpClient} from '@angular/common/http';\nimport {Injectable} from '@angular/core';\nimport {environment} from 'src/environments/environment';\nimport {UserCollection} from '../_models/collection-tag';\nimport {TextResonse} from '../_types/text-response';\nimport {MalStack} from \"../_models/collection/mal-stack\";\nimport {Action, ActionItem} from \"./action-factory.service\";\nimport {User} from \"../_models/user\";\nimport {AccountService} from \"./account.service\";\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class CollectionTagService {\n\n  baseUrl = environment.apiUrl;\n\n  constructor(private httpClient: HttpClient, private accountService: AccountService) { }\n\n  allCollections(ownedOnly = false) {\n    return this.httpClient.get<UserCollection[]>(this.baseUrl + 'collection?ownedOnly=' + ownedOnly);\n  }\n\n  allCollectionsForSeries(seriesId: number, ownedOnly = false) {\n    return this.httpClient.get<UserCollection[]>(this.baseUrl + 'collection/all-series?ownedOnly=' + ownedOnly + '&seriesId=' + seriesId);\n  }\n\n  updateTag(tag: UserCollection) {\n    return this.httpClient.post(this.baseUrl + 'collection/update', tag, TextResonse);\n  }\n\n  promoteMultipleCollections(tags: Array<number>, promoted: boolean) {\n    return this.httpClient.post(this.baseUrl + 'collection/promote-multiple', {collectionIds: tags, promoted}, TextResonse);\n  }\n\n  updateSeriesForTag(tag: UserCollection, seriesIdsToRemove: Array<number>) {\n    return this.httpClient.post(this.baseUrl + 'collection/update-series', {tag, seriesIdsToRemove}, TextResonse);\n  }\n\n  addByMultiple(tagId: number, seriesIds: Array<number>, tagTitle: string = '') {\n    return this.httpClient.post(this.baseUrl + 'collection/update-for-series', {collectionTagId: tagId, collectionTagTitle: tagTitle, seriesIds}, TextResonse);\n  }\n\n  tagNameExists(name: string) {\n    return this.httpClient.get<boolean>(this.baseUrl + 'collection/name-exists?name=' + name);\n  }\n\n  deleteTag(tagId: number) {\n    return this.httpClient.delete<string>(this.baseUrl + 'collection?tagId=' + tagId, TextResonse);\n  }\n\n  deleteMultipleCollections(tags: Array<number>) {\n    return this.httpClient.post(this.baseUrl + 'collection/delete-multiple', {collectionIds: tags}, TextResonse);\n  }\n\n  getMalStacks() {\n    return this.httpClient.get<Array<MalStack>>(this.baseUrl + 'collection/mal-stacks');\n  }\n\n  actionListFilter(action: ActionItem<UserCollection>, user: User) {\n    const canPromote = this.accountService.hasAdminRole(user) || this.accountService.hasPromoteRole(user);\n    const isPromotionAction = action.action == Action.Promote || action.action == Action.UnPromote;\n\n    if (isPromotionAction) return canPromote;\n    return true;\n  }\n\n  importStack(stack: MalStack) {\n    return this.httpClient.post(this.baseUrl + 'collection/import-stack', stack, TextResonse);\n  }\n}\n"],
  "mappings": "sJAaA,IAAaA,GAAoB,IAAA,CAA3B,IAAOA,EAAP,MAAOA,CAAoB,CAI/BC,YAAoBC,EAAgCC,EAA8B,CAA9D,KAAAD,WAAAA,EAAgC,KAAAC,eAAAA,EAFpD,KAAAC,QAAUC,EAAYC,MAEgE,CAEtFC,eAAeC,EAAY,GAAK,CAC9B,OAAO,KAAKN,WAAWO,IAAsB,KAAKL,QAAU,wBAA0BI,CAAS,CACjG,CAEAE,wBAAwBC,EAAkBH,EAAY,GAAK,CACzD,OAAO,KAAKN,WAAWO,IAAsB,KAAKL,QAAU,mCAAqCI,EAAY,aAAeG,CAAQ,CACtI,CAEAC,UAAUC,EAAmB,CAC3B,OAAO,KAAKX,WAAWY,KAAK,KAAKV,QAAU,oBAAqBS,EAAKE,CAAW,CAClF,CAEAC,2BAA2BC,EAAqBC,EAAiB,CAC/D,OAAO,KAAKhB,WAAWY,KAAK,KAAKV,QAAU,8BAA+B,CAACe,cAAeF,EAAMC,SAAAA,CAAQ,EAAGH,CAAW,CACxH,CAEAK,mBAAmBP,EAAqBQ,EAAgC,CACtE,OAAO,KAAKnB,WAAWY,KAAK,KAAKV,QAAU,2BAA4B,CAACS,IAAAA,EAAKQ,kBAAAA,CAAiB,EAAGN,CAAW,CAC9G,CAEAO,cAAcC,EAAeC,EAA0BC,EAAmB,GAAE,CAC1E,OAAO,KAAKvB,WAAWY,KAAK,KAAKV,QAAU,+BAAgC,CAACsB,gBAAiBH,EAAOI,mBAAoBF,EAAUD,UAAAA,CAAS,EAAGT,CAAW,CAC3J,CAEAa,cAAcC,EAAY,CACxB,OAAO,KAAK3B,WAAWO,IAAa,KAAKL,QAAU,+BAAiCyB,CAAI,CAC1F,CAEAC,UAAUP,EAAa,CACrB,OAAO,KAAKrB,WAAW6B,OAAe,KAAK3B,QAAU,oBAAsBmB,EAAOR,CAAW,CAC/F,CAEAiB,0BAA0Bf,EAAmB,CAC3C,OAAO,KAAKf,WAAWY,KAAK,KAAKV,QAAU,6BAA8B,CAACe,cAAeF,CAAI,EAAGF,CAAW,CAC7G,CAEAkB,cAAY,CACV,OAAO,KAAK/B,WAAWO,IAAqB,KAAKL,QAAU,uBAAuB,CACpF,CAEA8B,iBAAiBC,EAAoCC,EAAU,CAC7D,IAAMC,EAAa,KAAKlC,eAAemC,aAAaF,CAAI,GAAK,KAAKjC,eAAeoC,eAAeH,CAAI,EAGpG,OAF0BD,EAAOA,QAAUK,EAAOC,SAAWN,EAAOA,QAAUK,EAAOE,UAEvDL,EACvB,EACT,CAEAM,YAAYC,EAAe,CACzB,OAAO,KAAK1C,WAAWY,KAAK,KAAKV,QAAU,0BAA2BwC,EAAO7B,CAAW,CAC1F,yCAxDWf,GAAoB6C,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAApB/C,EAAoBgD,QAApBhD,EAAoBiD,UAAAC,WAFnB,MAAM,CAAA,EAEd,IAAOlD,EAAPmD,SAAOnD,CAAoB,GAAA",
  "names": ["CollectionTagService", "constructor", "httpClient", "accountService", "baseUrl", "environment", "apiUrl", "allCollections", "ownedOnly", "get", "allCollectionsForSeries", "seriesId", "updateTag", "tag", "post", "TextResonse", "promoteMultipleCollections", "tags", "promoted", "collectionIds", "updateSeriesForTag", "seriesIdsToRemove", "addByMultiple", "tagId", "seriesIds", "tagTitle", "collectionTagId", "collectionTagTitle", "tagNameExists", "name", "deleteTag", "delete", "deleteMultipleCollections", "getMalStacks", "actionListFilter", "action", "user", "canPromote", "hasAdminRole", "hasPromoteRole", "Action", "Promote", "UnPromote", "importStack", "stack", "\u0275\u0275inject", "HttpClient", "AccountService", "factory", "\u0275fac", "providedIn", "_CollectionTagService"]
}