import { Component, Input } from '@angular/core';
import moment from 'moment';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../app-toc-session-card-new/app-toc-session-card-new.component";
export class AppTocSessionsNewComponent {
    constructor() {
        this.content = null;
        this.forPreview = false;
        this.config = null;
        this.sessionList = [];
        this.sessionListMap = {};
        this.sessionType = [];
    }
    ngOnInit() {
    }
    getBatchHashMap() {
        if (this.batchData) {
            // tslint:disable-next-line:max-line-length
            if (this.batchData.content[0] && this.batchData.content[0].batchAttributes && this.batchData.content[0].batchAttributes.sessionDetails_v2 && this.batchData.content[0].batchAttributes.sessionDetails_v2.length > 0) {
                this.sessionList = this.batchData.content[0].batchAttributes.sessionDetails_v2;
                this.sessionList = this.sessionList.sort((a, b) => {
                    const dateA = new Date(a.startDate);
                    const dateB = new Date(b.startDate);
                    if (moment(a.startDate).isSame(b.startDate)) {
                        const atime = moment(a.startTime, 'hh:mm A').format('HH');
                        const btime = moment(b.startTime, 'hh:mm A').format('HH');
                        return atime - btime;
                    }
                    return dateA - dateB;
                });
                this.sessionListMap = {};
                this.sessionList.forEach((ele) => {
                    if (ele && !(ele.sessionType && this.sessionType.includes(ele.sessionType.toLowerCase()))) {
                        this.sessionType.push(ele.sessionType.toLowerCase());
                    }
                    this.sessionListMap[ele.sessionId] = ele;
                });
            }
        }
        return this.sessionListMap;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AppTocSessionsNewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AppTocSessionsNewComponent, selector: "ws-widget-app-app-toc-sessions-new", inputs: { batchData: "batchData", content: "content", forPreview: "forPreview", config: "config", batchId: "batchId", rootId: "rootId", rootContentType: "rootContentType", pathSet: "pathSet" }, ngImport: i0, template: "<div class=\"contents-container\">\n    <div class=\"main-container\">\n      <ng-container *ngIf=\"batchData?.content[0]?.batchAttributes?.sessionDetails_v2?.length > 0; else noChildren\">\n        <div class=\"content-card padding-right-m padding-left-m padding-top-s padding-bottom-s margin-bottom-m\">\n            <ws-widget-app-toc-session-card-new [forPreview]=\"forPreview\" [batchId]=\"batchId\" [content]=\"content\"  [pathSet]=\"pathSet\"  [rootId]=\"rootId\" [rootContentType]=\"rootContentType\" [batchData]=\"batchData\" [config]=\"config\"\n              [session]=\"getBatchHashMap()\" [sessionType]=\"sessionType\"></ws-widget-app-toc-session-card-new>\n          </div>\n      </ng-container>\n      <ng-template #noChildren>\n        <div>\n          No sessions available in this batch\n        </div>\n      </ng-template>\n    </div>\n  </div>", styles: [".contents-container{display:flex;justify-content:space-between;flex-wrap:wrap;margin:16px 0 24px}.contents-container .main-container{width:100%;box-sizing:border-box}.contents-container .main-container .toc-section{display:flex;justify-content:space-between;padding-bottom:12px}.contents-container .main-container .content-card{background:#fff;border-radius:8px;border:1px solid #F5F6FA;overflow:hidden;position:relative}.contents-container .main-container .noChildren{color:#222!important}@media only screen and (max-width: 959px){.contents-container .main-container{width:100%;padding-right:0;margin-bottom:32px}}.contents-container .side-container{flex:1;min-width:250px}@media only screen and (max-width: 959px){.contents-container .side-container{width:100%}}.playgrounds-container{margin:0 0 24px}.playgrounds-container .plg-card{position:relative;margin-bottom:12px;margin-right:24px}.playgrounds-container .plg-card .plg-img{display:block;width:265px;height:150px}.playgrounds-container .plg-card .plg-overlay{position:absolute;bottom:0;padding:8px 12px;box-sizing:border-box;left:0;right:0;background:linear-gradient(90deg,#000000,transparent);color:#fff}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.AppTocSessionCardNewComponent, selector: "ws-widget-app-toc-session-card-new", inputs: ["session", "expandAll", "rootId", "rootContentType", "forPreview", "batchData", "config", "index", "batchId", "content", "pathSet", "sessionType"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AppTocSessionsNewComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ws-widget-app-app-toc-sessions-new', template: "<div class=\"contents-container\">\n    <div class=\"main-container\">\n      <ng-container *ngIf=\"batchData?.content[0]?.batchAttributes?.sessionDetails_v2?.length > 0; else noChildren\">\n        <div class=\"content-card padding-right-m padding-left-m padding-top-s padding-bottom-s margin-bottom-m\">\n            <ws-widget-app-toc-session-card-new [forPreview]=\"forPreview\" [batchId]=\"batchId\" [content]=\"content\"  [pathSet]=\"pathSet\"  [rootId]=\"rootId\" [rootContentType]=\"rootContentType\" [batchData]=\"batchData\" [config]=\"config\"\n              [session]=\"getBatchHashMap()\" [sessionType]=\"sessionType\"></ws-widget-app-toc-session-card-new>\n          </div>\n      </ng-container>\n      <ng-template #noChildren>\n        <div>\n          No sessions available in this batch\n        </div>\n      </ng-template>\n    </div>\n  </div>", styles: [".contents-container{display:flex;justify-content:space-between;flex-wrap:wrap;margin:16px 0 24px}.contents-container .main-container{width:100%;box-sizing:border-box}.contents-container .main-container .toc-section{display:flex;justify-content:space-between;padding-bottom:12px}.contents-container .main-container .content-card{background:#fff;border-radius:8px;border:1px solid #F5F6FA;overflow:hidden;position:relative}.contents-container .main-container .noChildren{color:#222!important}@media only screen and (max-width: 959px){.contents-container .main-container{width:100%;padding-right:0;margin-bottom:32px}}.contents-container .side-container{flex:1;min-width:250px}@media only screen and (max-width: 959px){.contents-container .side-container{width:100%}}.playgrounds-container{margin:0 0 24px}.playgrounds-container .plg-card{position:relative;margin-bottom:12px;margin-right:24px}.playgrounds-container .plg-card .plg-img{display:block;width:265px;height:150px}.playgrounds-container .plg-card .plg-overlay{position:absolute;bottom:0;padding:8px 12px;box-sizing:border-box;left:0;right:0;background:linear-gradient(90deg,#000000,transparent);color:#fff}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { batchData: [{
                type: Input
            }], content: [{
                type: Input
            }], forPreview: [{
                type: Input
            }], config: [{
                type: Input
            }], batchId: [{
                type: Input
            }], rootId: [{
                type: Input
            }], rootContentType: [{
                type: Input
            }], pathSet: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 