// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------

import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
// swiftlint:disable cyclomatic_complexity

/// Request payload for updating a chat message.
public struct UpdateChatMessageRequest: Codable {
    // MARK: Properties

    /// Chat message content.
    public let content: String?
    /// Message metadata.
    public let metadata: [String: String?]?

    // MARK: Initializers

    /// Initialize a `UpdateChatMessageRequest` structure.
    /// - Parameters:
    ///   - content: Chat message content.
    ///   - metadata: Message metadata.
    public init(
        content: String? = nil, metadata: [String: String?]? = nil
    ) {
        self.content = content
        self.metadata = metadata
    }

    // MARK: Codable

    enum CodingKeys: String, CodingKey {
        case content = "content"
        case metadata = "metadata"
    }

    /// Initialize a `UpdateChatMessageRequest` structure from decoder
    public init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)
        self.content = try? container.decode(String.self, forKey: .content)
        self.metadata = try? container.decode([String: String?].self, forKey: .metadata)
    }

    /// Encode a `UpdateChatMessageRequest` structure
    public func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        if content != nil { try? container.encode(content, forKey: .content) }
        if metadata != nil { try? container.encode(metadata, forKey: .metadata) }
    }
}
