<?php

// OpenAPI spec definitions – moved from NGauge_Base/api/modules/v1/SwaggerController.php

declare(strict_types=1);

namespace portalpeople\apidocs\swagger;

#[\OpenApi\Attributes\OpenApi(
    openapi: "3.1.0",
    externalDocs: new \OpenApi\Attributes\ExternalDocumentation(description: 'Find out more', url: 'https://surf.sb.ion-club.net/api/v1/documentation/api'),
    info: new \OpenApi\Attributes\Info(
        title: "Surf API",
        version: "latest",
        description: "Allows Access to Surfing Elements Data Via API",
        contact: new \OpenApi\Attributes\Contact(
            email: "A.Pickstock@portalpeople.uk",
            name: "Portal People",
            url: "https://www.portalpeople.uk",
        ),
        license: new \OpenApi\Attributes\License(
            name: "PortalPeople Agreement",
            url: "https://www.portalpeople.uk",
        ),
    ),
    servers: [
        /*new \OpenApi\Attributes\Server(
            url: "https://api.ion-club.net/api",
            description: 'Live Server',
        ),*/
        new \OpenApi\Attributes\Server(
            url: "https://surf.sb.ion-club.net/api",
            description: 'Dev Server',
        )
    ],
    tags: [
        new \OpenApi\Attributes\Tag(name:"Debugging", description:"Used to Test API"),
        new \OpenApi\Attributes\Tag(name:"Check-In", description:"Used On Check-In Form"),
    ],
    components: new \OpenApi\Attributes\Components(
        securitySchemes: [
            /*new \OpenApi\Attributes\SecurityScheme(
                type: "apiKey",
                name: "api_key",
                in: "header",
                securityScheme: "api_key"
            ),*/    
            new \OpenApi\Attributes\SecurityScheme(
                type: "oauth2",
                securityScheme: "oauth2_scheme",
                flows: [
                    new \OpenApi\Attributes\Flow(
                        flow: "clientCredentials",
                        authorizationUrl: "/api/admin/site/token",
                        tokenUrl: "/api/admin/site/token",
                        scopes: [
                            'finance.read' => 'Read Finance Data',
                            'finance.write' => 'Write Finance Data',
                        ]
                    ),

                    /*
                    new \OpenApi\Attributes\Flow(
                        flow: "authorizationCode",
                        authorizationUrl: "/api/admin/user/authorize",
                        tokenUrl: "/api/admin/site/token",
                        refreshUrl: "/api/admin/site/token",
                        scopes: [],
                    )*/
                ]
            )
        ]
    )
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/finance/cartlinedata',
    description: "Exports Cart Information in Format for Excel.",
    responses: [
        new \OpenApi\Attributes\Response(
            response: 200, 
            description: 'OK',
            content:  [
                new \OpenApi\Attributes\MediaType(
                    mediaType: "application/json",
                    schema: new \OpenApi\Attributes\Schema(ref: "#/components/schemas/CartlinesSearch-ApiRequest-Response"),
                    
                ),        
            ],
        ),   
        new \OpenApi\Attributes\Response(response: 401, description: 'Unauthorized'),
        new \OpenApi\Attributes\Response(response: 403, description: 'Forbidden'),
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data'],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"filter",
            schema: new \OpenApi\Attributes\Schema(ref: "#/components/schemas/CartlineSearch-ApiRequest-Request"),
            style:"form",
            explode: true 
        )
    ]
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/finance/cartdata',
    description: "Exports Cart Information in Format for Excel.",
    responses: [
        new \OpenApi\Attributes\Response(
            response: 200, 
            description: 'OK',
            content:  [
                new \OpenApi\Attributes\MediaType(
                    mediaType: "application/json",
                    schema: new \OpenApi\Attributes\Schema(ref: "#/components/schemas/CartSearch-ApiRequest-Response"),
                    
                ),        
            ],
        ),   
        new \OpenApi\Attributes\Response(response: 401, description: 'Unauthorized'),
        new \OpenApi\Attributes\Response(response: 403, description: 'Forbidden'),
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data'],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"filter",
            schema: new \OpenApi\Attributes\Schema(ref: "#/components/schemas/CartSearch-ApiRequest-Request"),
            style:"form",
            explode: true 
        )
    ]
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/finance/financedata',
    description: "Exports Cart Information in Format for Excel.",
    responses: [
        new \OpenApi\Attributes\Response(
            response: 200, 
            description: 'OK',
            content:  [
                new \OpenApi\Attributes\MediaType(
                    mediaType: "application/json",
                    schema: new \OpenApi\Attributes\Schema(ref: "#/components/schemas/FinanceData-Finance-Response"),
                    
                ),        
            ],
        ),   
        new \OpenApi\Attributes\Response(response: 401, description: 'Unauthorized'),
        new \OpenApi\Attributes\Response(response: 403, description: 'Forbidden'),
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data'],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"filter",
            schema: new \OpenApi\Attributes\Schema(ref: "#/components/schemas/FinanceData-Finance-Request"),
            style:"form",
            explode: true 
        )
    ]
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/finance/nominaldata',
    description: "Exports Cart Information in Format for Excel.",
    responses: [
        new \OpenApi\Attributes\Response(
            response: 200, 
            description: 'OK',
        ),   
        new \OpenApi\Attributes\Response(response: 401, description: 'Unauthorized'),
        new \OpenApi\Attributes\Response(response: 403, description: 'Forbidden'),
    ],
    security: [
        ["oauth2_scheme" => ['finance.read']],
    ],
    tags:['Data'],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"centerid",
            style: "form",
            explode: true 
        ),
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"date",
            style:"form",
            explode: true 
        )
    ]
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/finance/adjustments',
    description: "Exports Cost Adjustments Information in Format for Excel.",
    responses: [
        new \OpenApi\Attributes\Response(
            response: 200, 
            description: 'OK',
        ),   
        new \OpenApi\Attributes\Response(response: 401, description: 'Unauthorized'),
        new \OpenApi\Attributes\Response(response: 403, description: 'Forbidden'),
    ],
    security: [
        ["oauth2_scheme" => ['finance.read']],
    ],
    tags:['Data'],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"centerid",
            style: "form",
            explode: true 
        ),
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"date",
            style:"form",
            explode: true 
        ),
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name:"pagesize",
            style:"form",
            explode: true 
        )
    ]
)]

#[\OpenApi\Attributes\Tag(name:"check-in",description: "Check-in API Actions")]
#[\OpenApi\Attributes\Get(
    path: '/v1/default/hotels?centerid={centerid}',
    description: "returns a list of Hotels based on the Centerid.",
    responses: [
        new \OpenApi\Attributes\Response(
            response: 200, 
            description: 'OK',
            content: new \OpenApi\Attributes\JsonContent(
                type: "array",
                items: new \OpenApi\Attributes\Items(
                    type: "object",
                    properties: [
                        new \OpenApi\Attributes\Property(
                            property: "country", 
                            type: "array", 
                            items: 
                                new \OpenApi\Attributes\Items(
                                    type: "object",
                                    properties: [
                                        new \OpenApi\Attributes\Property(property: "name", type: "string"),
                                        new \OpenApi\Attributes\Property(property: "value", type: "string")
                                    ]
                                )
                            
                        ),
                    ]
                )
            )
        ),   
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "centerid",
            description: "returns array of hotels for the center",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                enum: ['CPV', 'DEU', 'DOM', 'EGY', 'ESP', 'GBR', 'GRC', 'MAR', 'MUS', 'TUR']
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data']
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/default/centers',
    description: "returns a list of Active Centers.",
    
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data']
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/default/userdetails',
    description: "returns a user from Email and DOB.",
    
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data']
)]
#[\OpenApi\Attributes\Get(
    path: '/v1/default/attributevalues?name={name}',
    description: "Sends array data for the parameter",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Data']
)]
#[\OpenApi\Attributes\Post(
    path: '/v1/mailhooks/sendgrid',
    description: "Creates a Send Grid message log",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Mail']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/mailhooks/sendinblue',
    description: "Updates from Send in Blue, mailing Preferences",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Mail']
)] 

#[\OpenApi\Attributes\Post(
    path: '/v1/reports/',
    description: "Used for requesting Report Information",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['reports.read']],
    ],
    tags:['Reports']
)] 

#[\OpenApi\Attributes\Post(
    path: '/v1/booking/check',
    description: "Used for Prebookings",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Bookings']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/booking/checklocal',
    description: "Used in the POS",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Bookings']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/products/index',
    description: "lists Products",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: false,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Products']
)]
#[\OpenApi\Attributes\Post(
    path: '/v1/NGauge/create',
    description: "Creates a Blog Post for NGauge Updates",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['System']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/orders/approved',
    description: "Updates an Order from Concardis to add a payment to an Order",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Orders']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/orders/giftcard',
    description: "Creates a Voucher for Web-Site",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Orders']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/orders/orderconfirmation',
    description: "Completes the Journey for Web-site Orders",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "name",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['read']],
    ],
    tags:['Orders']
)] 
#[\OpenApi\Attributes\Post(
    path: '/v1/orders/checkpayments',
    description: "Checks and Assigns Payments to an Order",
    responses: [
        new \OpenApi\Attributes\Response(response: 200, description: 'OK'),
        new \OpenApi\Attributes\Response(response: 401, description: 'Not allowed'),
    ],
    parameters: [
        new \OpenApi\Attributes\Parameter(
            in:"query",
            name: "id",
            description: "Name of the Attribute to Return",
            required: true,
            schema: new \OpenApi\Attributes\Schema(
                type: "string",
            )
        )
    ],
    security: [
        ["oauth2_scheme" => ['orders.read', 'payments.read']],
    ],
    tags:['Orders']
)] 
class SwaggerDefinitions {}