import { Component, OnInit } from '@angular/core';
import { DatePipe, DecimalPipe } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';

import { HWGuildData, HWGuildClan, HWGuildStat } from '@models';

import guildData from 'src/files-data/hw-guild-data.json'; // page Membres

@Component({
    selector: 'app-guild-card',
    standalone: true,
    imports: [
        DatePipe, DecimalPipe,
        MatCardModule, MatDividerModule, MatIconModule
    ],
    templateUrl: './guild-card.component.html',
    styleUrl: './guild-card.component.scss'
})
export class GuildCardComponent implements OnInit {
    public guildData: HWGuildData = {} as HWGuildData;
    private _guildClan: HWGuildClan = {} as HWGuildClan;
    private _guildStat: HWGuildStat = {} as HWGuildStat;

    ngOnInit() {
        Object.assign(this._guildClan, guildData.clan);
        this.guildData.clan = this._guildClan;
        Object.assign(this._guildStat, guildData.stat);
        this.guildData.stat = this._guildStat;
        this.guildData.serverResetTime = guildData.serverResetTime;
        this.guildData.clanWarEndSeasonTime = guildData.clanWarEndSeasonTime;
        this.guildData.freeClanChangeInterval = guildData.freeClanChangeInterval;
        this.guildData.giftUids = guildData.giftUids;
    }
}
