<?php

namespace App\Models\DTO\Movie;
use JsonSerializable;

class InfoParams implements JsonSerializable
{
    public string $key;

    public function __construct(
        public string $movieCd = "",
        public int $dailyID = 0,
        public int $weeklyID = 0
    ) {
        $this->key = KOBIS_API_1;
    }

    public function jsonSerialize(): array
    {
        return [
            'movieCd' => $this->movieCd,
            'dailyID' => $this->dailyID,
            'weeklyID' => $this->weeklyID
        ];
    }

    public function toArray(): array
    {
        return [
            'key' => $this->key,
            'movieCd' => $this->movieCd,
            'dailyID' => $this->dailyID,
            'weeklyID' => $this->weeklyID
        ];
    }

    public function toJson(): string|false
    {
        return json_encode([
            'movieCd' => $this->movieCd,
            'dailyID' => $this->dailyID,
            'weeklyID' => $this->weeklyID
        ]);
    }
}
