<?php

namespace OtomaticAi\RestControllers;

use OtomaticAi\RestControllers\RestController;
use OtomaticAi\Utils\Settings;

class AmazonController extends RestController
{
    public function show()
    {
        return Settings::get('amazon');
    }

    public function update()
    {
        $this->validate([
            "affiliate_id" => ["nullable", "string"],
            "store" => ["required", "string"],
        ]);

        Settings::update($this->request, 'amazon');

        Settings::save();

        return [
            "success" => true,
        ];
    }
}
