<?php

namespace App\Http\Controllers;

use App\Repositories\CompanyRepository;
use App\Repositories\LegalRepository;
use Illuminate\Http\Request;

class LegalController extends Controller {
    public function terminosCondiciones() {
        try {
            $data = LegalRepository::terminosCondiciones();
        }
        catch(\Exception $e) { return response()->json(["error" => $e->getMessage()], 400); };

        return response()->json(["data" => $data]);
    }

    public function politicaPrivacidad() {
        try {
            $data = LegalRepository::politicaPrivacidad();
        }
        catch(\Exception $e) { return response()->json(["error" => $e->getMessage()], 400); };

        return response()->json(["data" => $data]);
    }

    public function avisoLegalBasico() {
        try {
            $data = LegalRepository::avisoLegalBasico();
        }
        catch(\Exception $e) { return response()->json(["error" => $e->getMessage()], 400); };

        return response()->json($data);
    }

    public function avisoLegalBasicoAtleta(Request $request) {
        try {
            $data = LegalRepository::avisoLegalBasicoAtleta($request->company_id);
        }
        catch(\Exception $e) { return response()->json(["error" => $e->getMessage()], 400); };

        return response()->json($data);
    }

    public function avisoLegalCompleto() {
        try {
            $data = LegalRepository::avisoLegalCompleto();
        }
        catch(\Exception $e) { return response()->json(["error" => $e->getMessage()], 400); };

        return response()->json(["data" => $data]);
    }

    public function avisoLegalCompletoAtleta(Request $request) {
        try {
            $data = LegalRepository::avisoLegalCompletoAtleta($request->company_id);
        }
        catch(\Exception $e) { return response()->json(["error" => $e->getMessage()], 400); };

        return response()->json(["data" => $data]);
    }
}
