<?php

namespace App\PackagesApi\v3\Controllers\Core;

use App\Http\Controllers\Controller;
use App\Packages\Core\Service\CryptService;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;

/**
 * Class GlobalController
 *
 * @package App\Http\Controllers\API
 */
class GlobalController extends Controller
{
    /**
     * @return JsonResponse
     */
    public function settings()
    {
        return jsonSuccess(
            [
                'global' => [
//                    'aws_access_key' => env('AWS_ACCESS_KEY_ID'),
//                    'aws_secret_key' => env('AWS_SECRET_ACCESS_KEY'),

                    'video' => [
                        'bucket' => env('AWS_VIDEO_BUCKET'),
                        'region' => env('AWS_DEFAULT_REGION'),
                        'endpoint' => env('AWS_URL'),
                    ],

                    'aws_access' => CryptService::encryptStringBase64(env('AWS_ACCESS_KEY_ID')),
                    'aws_secret' => CryptService::encryptStringBase64(env('AWS_SECRET_ACCESS_KEY')),
                ],
            ]
        );
    }

    /**
     * @return JsonResponse
     */
    public function serverTime()
    {
        $now = new Carbon('now');

        return jsonSuccess(
            [
                'time' => $now->format('Y-m-d H:i:s'),
                'timezone' => $now->tzName
            ]
        );
    }

    /**
     * @return JsonResponse
     */
    public function messages()
    {
        return jsonSuccess(
            [
                'messages' => [
                    'invite_text' => trans('main.sms_invite'),
                    'invite_capsule_text' => trans('main.sms_capsule_invite'),

                    /********** AUTHENTICATION **********/
                    "auth_phone_number" => "Phone Number",
                    "auth_add_username" => "Add Username",
                    "auth_checkbox_agree" => "I agree to the Timecaps",
                    "auth_terms_and_conditions" => "Terms & Conditions",
                    "auth_checkbox_age" => "I am 13+ years old",
                    "auth_code_sent_via_sms" => "Code sent via SMS for verification to phone number to finish registration",
                    "auth_resend_code" => "Resend code",
                    "auth_finish" => "Finish",
                    "auth_back_to_phone_number" => "Back to phone number",
                    /********** ONBOARDING **********/
                    "onboarding_create_capsule" => "Create a capsule with your message to the future",
                    "onboarding_watch_capsule" => "Watch your capsule when the time comes...",
                    "onboarding_set_capsule_date" => "Set capsule's opening date & time",
                    "onboarding_got_it" => "Got it!",
                    /********** FORCE UPDATE **********/
                    "force_update_description" => "This version of Timecaps has expired. Please go to the App Store to update it.",
                    "force_update_button" => "Update TimeCaps",
                    /********** SETTINGS **********/
                    "settings_title" => "settings",
                    "settings_change_profile_photo" => "Change profile photo",
                    "settings_delete" => "Delete",
                    "settings_name" => "Name",
                    "settings_username" => "Username",
                    "settings_phone" => "Phone",
                    "settings_in_app_notifications" => "In-app notifications",
                    "settings_push_notifications" => "Push notifications",
                    "settings_help_center" => "Help Center",
                    "settings_report_problem" => "Report a problem",
                    "settings_share_feedback" => "Share feedback/idea",
                    "settings_about_us" => "About us",
                    "settings_privacy_policy" => "Privacy Policy",
                    "settings_terms_and_conditions" => "Terms & Conditions",
                    "settings_invite_friends" => "Invite Friends",
                    "settings_logins" => "Logins",
                    "settings_logout" => "Logout",
                    "settings_delete_account" => "Delete account",
                    "settings_delete_account_confirmation" => "Are you sure you want to delete your account?",
                    "settings_support_email" => "support@timecaps.com",
                    /********** USER LIST **********/
                    "user_list_likes_title" => "Likes",
                    "user_list_followers_title" => "Followers",
                    "user_list_tag_friends_title" => "Tag Friends",
                    /********** PROFILE **********/
                    "profile_title" => "Profile",
                    "profile_caps" => "CAPS",
                    "profile_friends" => "FRIENDS",
                    "profile_locked_caps" => "Locked Caps",
                    "profile_unlocked_caps" => "Unlocked Caps",
                    "profile_unfriend_confirmation" => "Are you sure you want to unfriend this user?",
                    "profile_add_friend_start_description" => "This person is not yet your TimeCaps friend.\nClick the",
                    "profile_add_friend_end_description" => "to send friend request",
                    "profile_restart_upload_confirmation" => "Would you like to restart this upload or discard it?",
                    "profile_cancel_upload_confirmation" => "Would you like to cancel and discard this upload? This action cannot be undone.",
                    "profile_cancel_upload_confirmation_title" => "Upload",
                    /********** FRIENDS **********/
                    "friends_title" => "Friends",
                    "friends_friends_tab" => "Friends %@",
                    "friends_contacts_tab" => "Contacts",
                    "friends_new_requests" => "New Requests",
                    "friends_send_sms_confirmation" => "This contact is not using the app yet.\nWould you like to send SMS with invitation?",
                    "friends_send_sms_confirmation_yes" => "Invite",
                    "friends_notify_tagged_contacts_confirmation" => "You have some contacts tagged in this capsule, who are not using TimeCaps. Would you like to send SMS to notify them",
                    "friends_invitation_sent" => "Invitation sent!",
                    /********** CAPSULE **********/
                    "capsule_title" => "Capsule",
                    "capsule_remove_capsule_from_timeline_confirmation" => "Are you sure you want to remove this Capsule from your timeline?",
                    "capsule_destroy_capsule_confirmation" => "Are you sure you want to destroy this Capsule?",
                    "capsule_report_capsule_confirmation" => "Are you sure, you want to report this Capsule?",
                    "capsule_remove_tag_confirmation" => "Are you sure you want to remove your tag from this Capsule?",
                    "capsule_reported_capsule_confirmation" => "Capsule has been reported. \n Thank you!",
                    "capsule_reported_capsule_confirmation_title" => "Reported",
                    /********** NOTIFICATIONS **********/
                    "notifications_title" => "Notifications",
                    "notifications_today" => "Today",
                    "notifications_yesterday" => "Yesterday",
                    "notifications_commented" => "Commented %@",
                    "notifications_liked" => "Liked %@",
                    "notifications_mentioned_you" => "Mentioned you %@",
                    "notifications_tagged_you" => "Tagged you %@",
                    "notifications_capsule_unlocked" => "Capsule is unlocked %@",
                    "notifications_followed_capsule" => "Followed capsule %@",
                    "notifications_accepted_friend_request" => "Accepted friend request %@",
                    "notifications_capsule_blocked" => "Blocked capsule %@",
                    "notifications_unknown_action" => "Unknown action",
                    /********** GALLERY **********/
                    "gallery_title" => "Videos",
                    /********** RECORDING **********/
                    "recording_started_creating_capsule_confirmation" => "You have started creating a Capsule. Would you like to continue or discard and start a new Capsule?",
                    "recording_started_creating_capsule_confirmation_yes" => "Continue",
                    "recording_started_creating_capsule_confirmation_no" => "Discard",
                    /********** CAPSULE CAPTION **********/
                    "capsule_caption_title" => "Comment",
                    "capsule_caption_add_comment" => "Add comment",
                    /********** CAPSULE IMAGE PICKER **********/
                    "capsule_image_picker_title" => "Preview",
                    /********** CREATE CAPSULE **********/
                    "create_capsule_frame_preview" => "Pick-up the frame for preview",
                    "create_capsule_write_caption" => "Write a caption",
                    "create_capsule_open_date" => "Date to open",
                    "create_capsule_tag_friends" => "Tag Friends",
                    "create_capsule_add_location" => "Add location",
                    "create_capsule_private" => "Private",
                    "create_capsule_upload" => "Upload",
                    "create_capsule_successful_upload_title" => "Your Capsule was upload successfully",
                    "create_capsule_successful_upload_description" => "Check your profile to see the Capsule.",
                    "create_capsule_upload_progress_title" => "Capsule upload is in progress.",
                    "create_capsule_upload_progress_description" => "You have an active capsule upload in progress, which will be suspended while the TimeCaps app is not working.",
                    "create_capsule_upload_failed_title" => "Capsule upload failed",
                    "create_capsule_upload_failed_description" => "Video upload failed.",
                    /********** ERRORS **********/
                    "error_title" => "Error",
                    "error_set_date" => "Set the opening date and time",
                    "error_allow_access" => "Please go to the settings to allow access.",
                    "error_app_restricted_photo_gallery" => "Your app is restricted to access photo gallery",
                    "error_retrieving_file" => "There was a problem with retrieving the file.",
                    "error_video_problem" => "There was a problem with the video",
                    "error_video_maximum_duration" => "Sorry, the video exceeds the maximum allowed duration (10 minutes)",
                    "error_retrieve_video" => "Could not retrieve the video.",
                    "error_video_maximum_size" => "Sorry, the video exceeds the maximum allowed file size $@mb)",
                    "error_recording_access_denied" => "Recording access has been denied or restriced. Please visit settings to re-enable.",
                    "error_contact_access_denied" => "Contact access has been denied or restriced. Please visit settings to re-enable.",
                    "error_location_services_disabled" => "Location services are disabled. Please visit settings to re-enable.",
                    "error_location_access_denied" => "Location access has been denied or restriced. Please visit settings to re-enable.",
                    "error_photo_access_denied" => "Photo access has been denied or restriced. Please visit settings to re-enable.",
                    "error_permission_title" => "Permission Error",
                    "error_contacts_synchronization" => "Could not synchronize contacts",
                    "error_add_capsule" => "Could not add this capsule to your timeline, please try again later",
                    "error_remove_capsule" => "Could not remove the capsule from your timeline, please try again later",
                    "error_destroy_capsule" => "Could not destroy the capsule, please try again later",
                    "error_send_report" => "Could not send the report, please try again later",
                    "error_internet_connection_offline" => "The Internet connection appears to be offline.",
                    "error_network_status_cellular_title" => "Cellular",
                    "error_network_status_wifi_title" => "WiFi",
                    "error_network_status_no_connection_title" => "No Connection",
                    "error_something_wrong" => "Something went wrong!",
                    "error_invite_user" => "Could not invite this user",
                    "error_incorrect_phone_number" => "Incorrect Phone Number!",
                    "error_update_tags" => "Could not update tags",
                    "error_send_message" => "Message could not be sent",
                    "error_no_image_found" => "No images found!",
                    "error_mail_open" => "Mail can't be opened. Not supported by this device.",
                    "error_load_data" => "Could not load data",
                    "error_open_capsule" => "Something went wrong, could not open this capsule, try again later",
                    "error_remove_tag" => "Could not remove your tag.",
                    "error_capsule_blocked" => "Your capsule is blocked by admin",
                    "error_capsule_blocked_title" => "Blocked capsule",
                    "error_capsule_permission_denied" => "You do not have the permission to view this capsule.",
                    "error_capsule_permission_denied_title" => "Access Denied",
                    /********** ALERT **********/
                    "alert_edit_title" => "edit",
                    "alert_tag_friends_title" => "Tag Friends",
                    "alert_destroy_title" => "Destroy",
                    "alert_add_to_timeline_title" => "Add to Timeline",
                    "alert_remove_from_timeline_title" => "Remove from Timeline",
                    "alert_remove_from_tagged_title" => "Remove me from tagged",
                    "alert_report_title" => "Report",
                    "alert_take_photo_title" => "Take Photo",
                    "alert_choose_from_library_title" => "Choose from Library",
                    "alert_delete_title" => "Delete",
                    /********** MISC **********/
                    "search" => "Search",
                    "settings" => "Settings",
                    "not_available" => "N/A",
                    "button_done" => "Done",
                    "button_back" => "Back",
                    "button_cancel" => "Cancel",
                    "button_yes" => "YES",
                    "button_no" => "NO",
                    "button_ok" => "Ok",
                    "button_next" => "Next",
                    "button_restart" => "Restart",
                    "button_discard" => "Discard",
                ],
            ]
        );
    }

}
