/*
 * Copyright (C) 2019 Robert Bosch GmbH Copyright (C) 2019 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { Component } from '@angular/core';
import { TicketCard } from './ticket-card/ticket-card';
import { ScrollIntoViewService } from '../../shared/scroll-into-view.service';

@Component({
  selector: 'bci-card-demo',
  templateUrl: 'card-demo.html',
  styleUrls: ['card-demo.scss'],
})
export class CardDemoComponent {
  title = ' Ticket title';
  timestamp: string | null = '10.04.2019';
  status: string | null = null;
  message =
    'Appeared the first time with last major release 4.0. We are in urgent need of a working license to complete our tasks within the schedules.';
  cardColorState = '';
  cardColorStateDisabled = 'blue';
  cardDisabledState = false;
  focusCard = false;
  showDisabledCard = true;
  showDisabledBorder = false;
  cardDisabledStateWithBorder = false;
  cardHorizontalColorStateDisabled = 'blue';
  cardHorizontalDisabledState = false;
  focusCardHorizontal = false;
  cardHorizontalDisabledStateWithBorder = false;
  cardHoverPressedStyling = true;
  cardHorizontalHoverPressedStyling = false;
  cardData1: TicketCard = { colorState: 'yellow', title: 'Ticket 123589', optionalTitle: 'Optional Title', severity: 'Medium', solutionGroup: 'Developer', ticketType: 'Development', origin: 'Origin', dateCreated: '01.12.2023', focus: null, disabled: false };
  cardData2: TicketCard = { colorState: '', title: 'Ticket 398452', optionalTitle: 'Optional Title', severity: '-', solutionGroup: 'Solution Group', ticketType: 'Maintenance', origin: 'Origin', dateCreated: '02.11.2023', focus: null, disabled: false };
  cardData3: TicketCard = { colorState: 'red', title: 'Ticket 147856', optionalTitle: 'Optional Title', severity: 'High', solutionGroup: 'Management', ticketType: 'Leadership', origin: 'Origin', dateCreated: '03.10.2023', focus: null, disabled: false };
  cardData4: TicketCard = { colorState: 'blue', title: 'Ticket 698545', optionalTitle: 'Optional Title', severity: 'Normal', solutionGroup: 'Design Team', ticketType: 'Design Thinking', origin: 'Origin', dateCreated: '04.09.2023', focus: null, disabled: false };
  cardData5: TicketCard = { colorState: 'blue', title: 'Ticket 365412', optionalTitle: 'Optional Title', severity: 'Normal', solutionGroup: 'Management Group', ticketType: 'Leadership', origin: 'Origin', dateCreated: '05.08.2023', focus: null, disabled: false };
  cardData6: TicketCard = { colorState: 'green', title: 'Ticket 874562', optionalTitle: 'Optional Title', severity: 'Low', solutionGroup: 'Customer', ticketType: 'Maintenance', origin: 'Origin', dateCreated: '06.07.2023', focus: null, disabled: false };
  cardData7: TicketCard = { colorState: 'neutral', title: 'Ticket 985415', optionalTitle: 'Optional Title', severity: '-', solutionGroup: 'Solution Group', ticketType: 'Ticket Type', origin: 'Origin', dateCreated: '07.06.2023', focus: null, disabled: false };
  cardData8: TicketCard = { colorState: 'blue', title: 'Ticket 369852', optionalTitle: 'Optional Title', severity: 'Normal', solutionGroup: 'Design Team', ticketType: 'Maintenance', origin: 'Origin', dateCreated: '08.05.2023', focus: null, disabled: false };
  cardData9: TicketCard = { colorState: 'green', title: 'Ticket 147852', optionalTitle: 'Optional Title', severity: 'Low', solutionGroup: 'Solution Group', ticketType: 'Default', origin: 'Origin', dateCreated: '09.04.2023', focus: null, disabled: false };
  cardData10: TicketCard = { colorState: 'yellow', title: 'Ticket 456987', optionalTitle: 'Optional Title', severity: 'Medium', solutionGroup: 'Electrician', ticketType: 'Ticket Type', origin: 'Origin', dateCreated: '10.03.2023', focus: null, disabled: false };
  cardData11: TicketCard = { colorState: 'neutral', title: 'Ticket 963258', optionalTitle: 'Optional Title', severity: 'Low', solutionGroup: 'Developer', ticketType: 'Maintenance', origin: 'Origin', dateCreated: '11.02.2023', focus: null, disabled: false };
  cardData12: TicketCard = { colorState: 'red', title: 'Ticket 852147', optionalTitle: 'Optional Title', severity: 'High', solutionGroup: 'Finance', ticketType: 'Money', origin: 'Origin', dateCreated: '12.01.2023', focus: null, disabled: false };

  constructor(public scrollIntoViewService: ScrollIntoViewService) {}

  selectDisabledBorder() {
    this.cardDisabledState = true;
  }

  selectDefaultColor() {
    if (this.cardDisabledState) {
      this.cardColorStateDisabled = "blue";
      this.cardDisabledStateWithBorder = false;
    }
  }

  selectHorizontalDefaultColor() {
    if (this.cardHorizontalDisabledState) {
      this.cardHorizontalColorStateDisabled = "blue";
      this.cardHorizontalDisabledStateWithBorder = false;
    }
  }

  resetDisabledBorder() {
    if (this.showDisabledBorder) {
      this.showDisabledBorder = false;
    }
  }

  borderDisabled() {
    if (!this.showDisabledCard) {
      this.showDisabledCard = true;
    }
  }
}
