// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation

public struct GenerateStemSpec: Codable, Equatable {
    public var clipId: String
    public var imagePrompt: String?
    public var projectId: String?
    public var stemName: StemName
    public var stemTask: String?
    public var stemTypeGroupName: String?
    public var stemTypeId: Int?

    public struct StemName: Codable, Equatable {
        public var string: String?
        public var strings: [String]?

        public init(string: String? = nil, strings: [String]? = nil) {
            self.string = string
            self.strings = strings
        }

        public init(from decoder: Decoder) throws {
            let container = try decoder.singleValueContainer()
            self.string = try? container.decode(String.self)
            self.strings = try? container.decode([String].self)
        }

        public func encode(to encoder: Encoder) throws {
            var container = encoder.singleValueContainer()
            if let value = string { try container.encode(value) }
            if let value = strings { try container.encode(value) }
        }
    }

    public init(clipId: String, imagePrompt: String? = nil, projectId: String? = nil, stemName: StemName, stemTask: String? = nil, stemTypeGroupName: String? = nil, stemTypeId: Int? = nil) {
        self.clipId = clipId
        self.imagePrompt = imagePrompt
        self.projectId = projectId
        self.stemName = stemName
        self.stemTask = stemTask
        self.stemTypeGroupName = stemTypeGroupName
        self.stemTypeId = stemTypeId
    }
}
