001/*
002 *   Copyright 2024 Vonage
003 *
004 *   Licensed under the Apache License, Version 2.0 (the "License");
005 *   you may not use this file except in compliance with the License.
006 *   You may obtain a copy of the License at
007 *
008 *        http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *   Unless required by applicable law or agreed to in writing, software
011 *   distributed under the License is distributed on an "AS IS" BASIS,
012 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *   See the License for the specific language governing permissions and
014 *   limitations under the License.
015 */
016package com.vonage.client.messages.whatsapp;
017
018import com.vonage.client.messages.MessageType;
019import com.vonage.client.messages.TextMessageRequest;
020
021public final class WhatsappTextRequest extends WhatsappRequest implements TextMessageRequest {
022
023        WhatsappTextRequest(Builder builder) {
024                super(builder, MessageType.TEXT);
025        }
026
027        @Override
028        protected int maxTextLength() {
029                return 4096;
030        }
031
032        @Override
033        public String getText() {
034                return super.getText();
035        }
036
037        public static Builder builder() {
038                return new Builder();
039        }
040
041        public static final class Builder extends WhatsappRequest.Builder<WhatsappTextRequest, Builder> implements TextMessageRequest.Builder<Builder> {
042
043                Builder() {}
044
045                /**
046                 * (REQUIRED)
047                 * Sets the text field. Must be between 1 and 4096 characters, including unicode.
048                 *
049                 * @param text The text string.
050                 * @return This builder.
051                 */
052                @Override
053                public Builder text(String text) {
054                        return super.text(text);
055                }
056
057                public WhatsappTextRequest build() {
058                        return new WhatsappTextRequest(this);
059                }
060        }
061}