// Path: print-api/src/main/java/com/aevi/print/PrinterManager.java
// public interface PrinterManager {
// 
//     /**
//      * @return True if the printing service is installed and available
//      */
//     boolean isPrinterServiceAvailable();
// 
//     /**
//      * Send a payload for printing
//      *
//      * @param printPayload The payload to print
//      * @return An observable stream of {@link PrintJob} which indicates the status of the printout
//      */
//     Observable<PrintJob> print(PrintPayload printPayload);
// 
//     /**
//      * Send an action to a printer
//      *
//      * @param printerId The id of the printer to send the action to
//      * @param action    The action to perform (see {@link PrinterSettings#getCommands() for a list of commands the printer supports}
//      */
//     void sendAction(String printerId, String action);
// 
//     /**
//      * A stream of {@link PrinterStatus} indicating the current state of the printer
//      *
//      * @param printerId The printerId to listen to
//      * @return An observable stream of {@link PrinterStatus}
//      */
//     Observable<PrinterStatus> status(String printerId);
// 
//     /**
//      * Returns the current settings for the default printer
//      *
//      * @return A Single which will emit the default printer settings if available
//      */
//     Single<PrinterSettings> getDefaultPrinterSettings();
// 
//     /**
//      * Returns an observable stream which will emit settings for all the available printers
//      *
//      * @return An observable stream containing a list of {@link PrinterSettings} objects contained in a {@link PrinterSettingsList} object
//      */
//     Observable<PrinterSettingsList> getPrintersSettings();
// }
// 
// Path: print-api/src/main/java/com/aevi/print/util/Preconditions.java
// public static <T> T checkNotNull(T object, String message) {
//     if (object == null) {
//         throw new IllegalArgumentException(message);
//     }
//     return object;
// }


import android.graphics.Bitmap;
import com.aevi.print.PrinterManager;
import com.aevi.util.json.JsonConverter;
import com.aevi.util.json.JsonOption;
import com.aevi.util.json.Jsonable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.aevi.print.util.Preconditions.checkNotNull;
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.aevi.print.model;





/**
 * A {@link PrintPayload} contains a collection of {@link PrintRow} that
 * represent a printable text document.
 *
 * By binding to the {@link PrinterManager} this pay load can be send to the
 * receipt printer for printing.
 */
public class PrintPayload implements Jsonable {

    private final List<JsonOption> rows = new ArrayList<>();

    private int codePage = -1;
    private String printerId;
    private String languageCode;

    /**
     * Creates an empty {@link PrintPayload} object.
     */
    public PrintPayload() {
    }

    /**
     * Creates an empty {@link PrintPayload} object.
     *
     * To be sent to a specific printer driver
     *
     * @param printerId The id of the printer to send this payload to for printing
     */
    public PrintPayload(String printerId) {
        this.printerId = printerId;
    }

    /**
     * Appends the given text row to this printer pay load.
     *
     * @param text the text to append to the printer pay load. This parameter
     *             must not be null.
     * @return The new {@link TextRow} object added to the payload
     */
    public TextRow append(String text) {
        return append(text, null);
    }

    /**
     * Appends the given text row to this printer payload and ensure the printer font given is used
     *
     * The font must match a {@link PrinterFont} as provided by the printer via its settings methods. See {@link PrinterSettings#getPrinterFonts()}.
     *
     * @param text        The text to add
     * @param printerFont The printer font to use
     * @return The new {@link TextRow} object added to the payload
     */
    public TextRow append(String text, PrinterFont printerFont) {
// Path: print-api/src/main/java/com/aevi/print/PrinterManager.java
// public interface PrinterManager {
// 
//     /**
//      * @return True if the printing service is installed and available
//      */
//     boolean isPrinterServiceAvailable();
// 
//     /**
//      * Send a payload for printing
//      *
//      * @param printPayload The payload to print
//      * @return An observable stream of {@link PrintJob} which indicates the status of the printout
//      */
//     Observable<PrintJob> print(PrintPayload printPayload);
// 
//     /**
//      * Send an action to a printer
//      *
//      * @param printerId The id of the printer to send the action to
//      * @param action    The action to perform (see {@link PrinterSettings#getCommands() for a list of commands the printer supports}
//      */
//     void sendAction(String printerId, String action);
// 
//     /**
//      * A stream of {@link PrinterStatus} indicating the current state of the printer
//      *
//      * @param printerId The printerId to listen to
//      * @return An observable stream of {@link PrinterStatus}
//      */
//     Observable<PrinterStatus> status(String printerId);
// 
//     /**
//      * Returns the current settings for the default printer
//      *
//      * @return A Single which will emit the default printer settings if available
//      */
//     Single<PrinterSettings> getDefaultPrinterSettings();
// 
//     /**
//      * Returns an observable stream which will emit settings for all the available printers
//      *
//      * @return An observable stream containing a list of {@link PrinterSettings} objects contained in a {@link PrinterSettingsList} object
//      */
//     Observable<PrinterSettingsList> getPrintersSettings();
// }
// 
// Path: print-api/src/main/java/com/aevi/print/util/Preconditions.java
// public static <T> T checkNotNull(T object, String message) {
//     if (object == null) {
//         throw new IllegalArgumentException(message);
//     }
//     return object;
// }


// Path: print-api/src/main/java/com/aevi/print/model/PrintPayload.java
import android.graphics.Bitmap;
import com.aevi.print.PrinterManager;
import com.aevi.util.json.JsonConverter;
import com.aevi.util.json.JsonOption;
import com.aevi.util.json.Jsonable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.aevi.print.util.Preconditions.checkNotNull;

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.aevi.print.model;





/**
 * A {@link PrintPayload} contains a collection of {@link PrintRow} that
 * represent a printable text document.
 *
 * By binding to the {@link PrinterManager} this pay load can be send to the
 * receipt printer for printing.
 */
public class PrintPayload implements Jsonable {

    private final List<JsonOption> rows = new ArrayList<>();

    private int codePage = -1;
    private String printerId;
    private String languageCode;

    /**
     * Creates an empty {@link PrintPayload} object.
     */
    public PrintPayload() {
    }

    /**
     * Creates an empty {@link PrintPayload} object.
     *
     * To be sent to a specific printer driver
     *
     * @param printerId The id of the printer to send this payload to for printing
     */
    public PrintPayload(String printerId) {
        this.printerId = printerId;
    }

    /**
     * Appends the given text row to this printer pay load.
     *
     * @param text the text to append to the printer pay load. This parameter
     *             must not be null.
     * @return The new {@link TextRow} object added to the payload
     */
    public TextRow append(String text) {
        return append(text, null);
    }

    /**
     * Appends the given text row to this printer payload and ensure the printer font given is used
     *
     * The font must match a {@link PrinterFont} as provided by the printer via its settings methods. See {@link PrinterSettings#getPrinterFonts()}.
     *
     * @param text        The text to add
     * @param printerFont The printer font to use
     * @return The new {@link TextRow} object added to the payload
     */
    public TextRow append(String text, PrinterFont printerFont) {
        checkNotNull(text, "text must not be null");