import { Component, OnInit, OnDestroy } from '@angular/core';

import { LocalStorageService } from '@ucap/ng-web-storage';

import { environment } from '@environments';

import { UserStore } from '@app/models/user-store';
import { AppKey } from '@app/types/app-key.type';

@Component({
  selector: 'app-pages-account-login',
  templateUrl: './login.page.component.html',
  styleUrls: ['./login.page.component.scss']
})
export class LoginPageComponent implements OnInit, OnDestroy {
  companyGroupCode = environment.companyConfig.companyGroupCode;
  userStore: UserStore;

  readonly useRememberMe =
    environment.productConfig.authentication.useRememberMe;

  readonly useAutoLogin = environment.productConfig.authentication.useAutoLogin;

  readonly fixedCompanyCode = environment.companyConfig.fixedCompanyCode;

  constructor(private localStorageService: LocalStorageService) {}

  ngOnInit(): void {
    this.userStore = this.localStorageService.encGet<UserStore>(
      AppKey.UserStore,
      environment.productConfig.localEncriptionKey
    );
  }

  ngOnDestroy(): void {}
}
