import { BufferGeometry } from "../core/BufferGeometry.js";

export interface TorusGeometryJSON {
    radius: number;
    tube: number;
    radialSegments: number;
    tubularSegments: number;
    arc: number;
}

/**
 * A class for generating torus geometries.
 * @example
 * ```typescript
 * const geometry = new THREE.TorusGeometry(10, 3, 16, 100);
 * const material = new THREE.MeshBasicMaterial({
 *     color: 0xffff00
 * });
 * const torus = new THREE.Mesh(geometry, material);
 * scene.add(torus);
 * ```
 * @see {@link https://threejs.org/docs/index.html#api/en/geometries/TorusGeometry | Official Documentation}
 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusGeometry.js | Source}
 */
export class TorusGeometry extends BufferGeometry {
    /**
     * @param radius Radius of the torus, from the center of the torus to the center of the tube. Default `1`.
     * @param tube Radius of the tube. Must be smaller than `radius`. Default is `0.4`.
     * @param radialSegments Default is `12`.
     * @param tubularSegments Default is `48`.
     * @param arc Central angle. Default is Math.PI * 2.
     * @param {number} [thetaStart=0] - Start of the tubular sweep in radians.
     * @param {number} [thetaLength=Math.PI times 2] - Length of the tubular sweep in radians.
     */
    constructor(
        radius?: number,
        tube?: number,
        radialSegments?: number,
        tubularSegments?: number,
        arc?: number,
        thetaStart?: number,
        thetaLength?: number,
    );

    /**
     * A Read-only _string_ to check if `this` object type.
     * @remarks Sub-classes will update this value.
     * @defaultValue `TorusGeometry`
     */
    override readonly type: string | "TorusGeometry";

    /**
     * An object with a property for each of the constructor parameters.
     * @remarks Any modification after instantiation does not change the geometry.
     */
    readonly parameters: {
        readonly radius: number;
        readonly tube: number;
        readonly radialSegments: number;
        readonly tubularSegments: number;
        readonly arc: number;
        readonly thetaStart: number;
        readonly thetaLength: number;
    };

    static fromJSON(data: TorusGeometryJSON): TorusGeometry;
}
