// SPDX-License-Identifier: Apache-2.0
// Copyright 2025 Caesar Cipher Project
//
// 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.

#ifndef CAESAR_CIPHER_H
#define CAESAR_CIPHER_H

#include <string>
#include <vector>

/**
 * @class CaesarCipher
 * @brief Implements Caesar cipher encryption and decryption
 *
 * The Caesar cipher is a simple substitution cipher where each letter
 * in the plaintext is shifted a certain number of places down or up
 * the alphabet. This implementation preserves case and non-alphabetic
 * characters while providing both encryption and decryption capabilities.
 */
class CaesarCipher {
public:
    // Constants
    static const int ALPHABET_SIZE = 26;

    // Lifecycle
    explicit CaesarCipher(int shift = 0);
    ~CaesarCipher();

    // Core Operations
    std::string Encrypt(const std::string& plaintext) const;
    std::string Decrypt(const std::string& ciphertext) const;

    // Character-level Operations
    char EncryptChar(char character) const;
    char DecryptChar(char character) const;

    // Accessors
    int GetShift() const;
    void SetShift(int shift);

    // Utility Methods
    static bool IsValidChar(char character);
    static std::vector<std::string> BruteForceDecrypt(const std::string& ciphertext);
    static void Demonstrate();

private:
    // Member variables
    int mShift;  // Shift value (normalized to 0-25 range)
};

#endif // CAESAR_CIPHER_H